-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe11.cpp
100 lines (90 loc) · 1.8 KB
/
e11.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "../std_lib_facilities.h"
int main ()
{
int pennies {0};
int nickels {0};
int dimes {0};
int quarters {0};
int half_dollars {0};
int dollars {0};
cout << "How many pennies do you have?\n";
cin >> pennies;
cout << "How many nickels do you have?\n";
cin >> nickels;
cout << "How many dimes do you have?\n";
cin >> dimes;
cout << "How many quarters do you have?\n";
cin >> quarters;
cout << "How many half dollars do you have?\n";
cin >> half_dollars;
cout << "How many dollar coins do you have?\n";
cin >> dollars;
if (pennies)
{
if (pennies == 1)
{
cout << "You have " << pennies << " pennie." << endl;
}
else
{
cout << "You have " << pennies << " pennies." << endl;
}
}
if (nickels)
{
if (nickels == 1)
{
cout << "You have " << nickels << " nickel." << endl;
}
else
{
cout << "You have " << nickels << " nickels." << endl;
}
}
if (dimes)
{
if (dimes == 1)
{
cout << "You have " << dimes << " dime." << endl;
}
else
{
cout << "You have " << dimes << " dimes." << endl;
}
}
if (quarters)
{
if (quarters == 1)
{
cout << "You have " << quarters << " quarter." << endl;
}
else
{
cout << "You have " << quarters << " quarters." << endl;
}
}
if (half_dollars)
{
if (half_dollars == 1)
{
cout << "You have " << half_dollars << " half dollar." << endl;
}
else
{
cout << "You have " << half_dollars << " half dollars." << endl;
}
}
if (dollars)
{
if (dollars == 1)
{
cout << "You have " << dollars << " dollar." << endl;
}
else
{
cout << "You have " << dollars << " dollars." << endl;
}
}
double total = pennies + 5 * nickels + 10 * dimes + 25 * quarters + 50 * half_dollars + 100 * dollars;
cout << "The value of all your coins is " << total << " cents ($" << total / 100 << ")." << endl;
}