My mistake is that i'm entering a float, which will be cast in to an integer when calling the toBase function. Hence, the fractional part of the number is gone at this moment. Then, in the very last line of main, i output "." << b, b being the base.
However, i'm still stumped and don't know how to proceed, should i change the int in toBase to float, and then use fmod for this part?
cout << alpha[n%base];