Help with making plurals in code

So for class we have to write a program like below - it breaks down cents into USD in that format. The only problem I have is that there is one of a unit it has to be singular (1 dime vs 2 dimes). How would I go about doing that? Thank you!

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
29
30
31
32
33
34
#include<iostream>


using namespace std;

int main()
{
	//Declaring variables
	cout << "Please enter number of cents: ";
    int cents;
	cin >> cents;
    
    int leftoverChange = cents;
	
    //finding number of dollars
    int dollars = leftoverChange / 100;
    leftoverChange = leftoverChange % 100;
    
    int quarters = leftoverChange / 25;
    leftoverChange = leftoverChange % 25;
    
    int dimes = leftoverChange / 10;
    leftoverChange = leftoverChange % 10;

    int nickels = leftoverChange / 5;
    leftoverChange = leftoverChange % 5;
    
    int pennies = leftoverChange;

    cout << "This corresponds to " << dollars << " dollars, " << quarters << " quarters, " << dimes << " dimes, " << nickels << " nickels and " << pennies << " pennies." << endl; 
	return 0;


}
Topic archived. No new replies allowed.