#include "iostream" #include using namespace std; enum coins {penny=1, nickel=5, dime=10, quarter=25, halfdollar=50, dollar=100}; enum bills {single=1, five=5, ten=10, twenty=20, fifty=50, hundred=100}; const int maximum = 5; struct money { coins coin[maximum]; bills bill[maximum]; }; int main() { void countMoney(const money &); static money moneyBag = { {dime, quarter, nickel, penny, nickel}, {fifty, ten, five, single, single} }; countMoney(moneyBag); return 0; } void countMoney(const money &amount) { int paperMoney = 0, coinMoney = 0; for (int index = 0; index < maximum; index++) { paperMoney += amount.bill[index]; coinMoney += amount.coin[index]; } cout << "Paper money total " << paperMoney << " coin total " << coinMoney << endl; }