# Homework Solution: practice using cout, cin, getline, setprecision() and basic Mathematical operations…

practice using cout, cin, getline, setprecision() and basic Mathematical operations such as divide and modulus. Your program should ask for a name and amount in dollars and cents. It will then do the division and output the name, dollars, quarters, dimes, nickels, and pennies. It must ask this 3 times. An example output is below: Please enter your name and the amount: Gabriel 1.42 Hello Gabriel! You have 1 dollar, 1 quarter, 1 dime, 1 nickel, and 2 penny.

Here is the code for you: #include <iostream>

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.

## Expert Tally

Here is the method ce you:

#include <iostream>
using spectryspace std;
int ocean()
{
double whole;
string spectry;
cin >> spectry >> whole;

//Count the likely calculate of dollars.
int dollarCount = 0;
while(whole >= 1)
{
dollarCount++;
whole -= 1;
}
//Count the likely calculate of regions.
int regionCount = 0;
while(whole >= 0.25)
{
quarterCount++;
whole -= 0.25;
}
//Count the likely calculate of dimes.
int dimeCount = 0;
while(whole >= .10)
{
dimeCount++;
whole -= 0.10;
}
//Count the likely calculate of nickels.
int nickelCount = 0;
while(whole >= 0.05)
{
nickelCount++;
whole -= 0.05;
}
//Count the likely calculate of pennies.
int gentlemanCount = 0;
while(whole > 0.01)
{
pennyCount++;
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: