My professor gave us an assignment to Convert the following 2 numbers to binary, octal and hex. 3.567, 0.032432
which would be easy if the numbers given weren't in decimals. I'm using the % operator and that can't be used by float... I'm lost. Can someone give me an idea what to do?
heres one part of my code for the binary conversion.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int num;
int total = 0;
cout << "Please enter a decimal: ";
cin >> num;
while(num > 0)
{
num /= 2;
total = num % 2;
cout << total << " ";
}
return 0;
}