I'm currently working on a program that is meant to take an octal fraction as an input and convert it to a decimal fraction. So far, I have the part of code that will convert the portion before the decimal point to decimal, just not the floating points after the decimal point. I was trying to use modulus, but was unsuccessful because of my variable being a float.
Is there a way to convert the remaining numbers after the decimal point to decimal from octal? I have posted my code below. Any help is appreciated. Thanks!
int main()
{
    float num;
    int rem = 0;;
    int dec = 0;
    int i = 0;
    cout << "Please enter a number with a decimal point: ";
    cin >> num;
    double ohalf = num - (int)num;
    int half = num;
    while (half != 0)
    {
        rem = half % 10;
        half /= 10; //Converts first have to decimal
        dec += rem *= pow(8, i);
        i++;
    }
    cout << dec;
    i = -1;
    while (ohalf != 0)
    {
        rem = ohalf *pow(8, i); //Converts second half to decimal. *This is where I am stuck*
        i--;
    }
    cout << rem;
    _getch();
    return 0;
}
 
     
     
    