01: /****************************************************************************
02: ** COPYRIGHT (C):    1998 Cay S. Horstmann. All Rights Reserved.
03: ** PROJECT:          Computing Concepts with C++ 2E
04: ** FILE:             coins5.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:    #include "ccc_ansi.cpp"
12:    #ifndef CCC_ANSI_H
13: 
14: #include <iostream>
15: 
16: using namespace std;
17: 
18:    #endif
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:         int value = pennies + 5 * nickels + 10 * dimes + 25 * quarters;
38:         int dollar = value / 100;
39:         int cents = value % 100;
40: 
41:         cout << "Total value = " << dollar << " dollar and "
42:                 << cents << " cents\n";
43: 
44:    return 0;
45: }
46: