Dollar Conversion

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???
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  #include <iostream>
using namespace 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;
}
Topic archived. No new replies allowed.