1: #include <iostream> 2: using namespace std; 3: 4: int main() 5: { cout << "How many pennies do you have? "; 6: int pennies; 7: cin >> pennies; 8: 9: 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: double total = pennies * 0.01 + nickels * 0.05 + 22: dimes * 0.10 + quarters * 0.25; 23: /* total value of the coins */ 24: 25: cout << "Total value = " << total << "\n"; 26: return 0; 27: }