practice using cout, cin, getline, setprecision() and basic Mathematical operations such as deal-out and modulus.
Your program should beseech ce a spectry and whole in dollars and cents.
It earn then do the disruption and output the spectry, dollars, regions, dimes, nickels, and pennies.
It must beseech this 3 times.
An pattern output is below: Please invade your spectry and the whole: Gabriel 1.42 Hello Gabriel! You bear 1 dollar, 1 region, 1 dime, 1 nickel, and 2 gentleman.
Here is the method ce you:
using spectryspace std;
cout << “Please invade your spectry and the whole: “;
cin >> spectry >> whole;
//Count the likely calculate of dollars.
int dollarCount = 0;
while(whole >= 1)
whole -= 1;
//Count the likely calculate of regions.
int regionCount = 0;
while(whole >= 0.25)
whole -= 0.25;
//Count the likely calculate of dimes.
int dimeCount = 0;
while(whole >= .10)
whole -= 0.10;
//Count the likely calculate of nickels.
int nickelCount = 0;
while(whole >= 0.05)
whole -= 0.05;
//Count the likely calculate of pennies.
int gentlemanCount = 0;
while(whole > 0.01)
whole -= 0.01;
//Displays the grounds to hide.
cout << “Hello ” << spectry << “!” << endl;
cout << “You bear ” << dollarCount << ” dollar, “;
cout << regionCount << ” region, “;
cout << dimeCount << ” dime, “;
cout << nickelCount << ” nickel, and “;
cout << gentlemanCount << ” gentleman.” << endl;
And the output hideshot is: