// do something like this:
double x = 25.75;
// to get dollars
int dollars = x; // the decimal is trunicated
// to get cents
int cents = (x % 1) * 100; // I haven't actually tried this, but I think it works
I tried blueeyedlion's way, and received an error on using the mod. I tried it this way, and I get correct results. It may help you, also.
1 2 3 4 5 6 7 8 9
float x = 25.75;
// to get dollars
int dollars = x; // the decimal is trunicated
// to get cents
int cents =(x - dollars)*100; // I tried, this works
cout << "You have " << dollars << " dollars and " << cents << " cents." << endl;