Make a program that inputs money in change. Then convert how much they have in whole dollars and cents. Then display the total sum of the dollars and cents. The code somewhat works, if I put 125 cents, it will give me 26, because it adds the 25 and the whole dollar 1. How do I convert the 25 to cents???
#include <iostream>
usingnamespace std;
int main()
{
char response;
int cents;
int dollars;
cout << "Please enter the amount of money you have in cents: " << endl;
cin >> cents;
double whole_dollar = cents / 100;
cout << "Your total whole dollars is: " << "$" << whole_dollar << ".00" << endl;
double leftover_cents = cents % 100; // this is correct, but does not return as decmil
double new_leftovercent = leftover_cents * -100; // where I need help converting the number to a decmil
cout << "Your total left over cents are: " << "$0." << new_leftovercent << endl;
cout << "Your total conversion is: " << whole_dollar + leftover_cents << endl;
cin >> response;
return 0;
}