01: #include <iostream> 02: using namespace std; 03: 04: int main() 05: { cout << "How many pennies do you have? "; 06: int pennies; 07: cin >> pennies; 08: 09: cout << "How many nickels do you have? "; 10: int nickels; 11: cin >> nickels; 12:
13: cout << "How many dimes do you have? "; 14: int dimes; 15: cin >> dimes; 16: 17: cout << "How many quarters do you have? "; 18: int quarters; 19: cin >> quarters; 20: 21: int value = pennies + 5 * nickels + 10 * dimes + 25 * quarters; 22: int dollar = value / 100; 23: int cents = value % 100; 24: 25: cout << "Total value = " << dollar << " dollar and " 25: << cents << " cents\n"; 27: return 0; 28: }