01: /****************************************************************************
02: ** COPYRIGHT (C):    1998 Cay S. Horstmann. All Rights Reserved.
03: ** PROJECT:          Computing Concepts with C++ 2E
04: ** FILE:             coins3.cpp
05: ** NOTE TO STUDENTS: This file has been edited to be compatible with older
06: ** compilers. If your compiler fully supports the ANSI/ISO C++
07: ** standard, remove the line #include "ccc_ansi.cpp". You can also remove
08: ** the lines #ifndef CCC_ANSI_H and #endif
09: ****************************************************************************/
10: 
11:    
12:    
13: 
14: #include <iostream>
15: 
16: using namespace std;
17: 
18:    
19: 
20: int main()
21: {  
       cout << "How many pennies do you have? ";
22:    int pennies;
23:    cin >> pennies;
24: 
25:    cout << "How many nickels do you have? ";
26:    int nickels;
27:    cin >> nickels;
28: 
29:    cout << "How many dimes do you have? ";
30:    int dimes;
31:    cin >> dimes;
32: 
33:    cout << "How many quarters do you have? ";
34:    int quarters;
35:    cin >> quarters;
36: 
37:    double total = pennies * 0.01 + nickels * 0.05 +
38:                   dimes * 0.10 + quarters * 0.25;
39:                         /* total value of the coins */
40: 
41:    cout << "Total value = " << total << "\n";
42: 
43:    return 0;
44: }