#include using namespace std; const int QUARTER = 25; const int DIME = 10; const int NICKEL = 5; const int PENNY = 1; int computeChange(int change, const int); int main() { int numQuarters = 0, numDimes = 0, numNickels = 0, numPennies = 0, change = 0, given = 0, bill = 0; cout << endl << "How much is the bill? "; cin >> bill; cout << "How much are you giving to cover the cost? "; cin >> given; change = given - bill; numQuarters = computeChange(change, QUARTER); change -= numQuarters * QUARTER; numDimes = computeChange(change, DIME); change -= numDimes * DIME; numNickels = computeChange(change, NICKEL); change -= numNickels * NICKEL; numPennies = computeChange(change, PENNY); change -= numPennies * PENNY; cout << endl << "Your change is the following: " << endl << endl << "Quarters: " << numQuarters << endl << "Dimes: " << numDimes << endl << "Nickels: " << numNickels << endl << "Pennies: " << numPennies << endl; return 0; } int computeChange(int money, const int SIZE_OF_COIN) { if(SIZE_OF_COIN == QUARTER) { return money/QUARTER; } else if(SIZE_OF_COIN == DIME) { return money/DIME; } else if(SIZE_OF_COIN == NICKEL) { return money/NICKEL; } else if(SIZE_OF_COIN == PENNY) { return money/PENNY; } return 0; }