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

//Code from other subgroup
#include <iostream>
#include <cmath>
using namespace std;
void inputs(double&, double&, double&, int&, int&);
void bills(int, int&, int&, int&, int&);
void coins(int, int&, int&, int&, int&);
void output(double, double, double, int, int, int, int, int, int, int, int);
int main()
{
double purchase, tendered, change;
int dollars, cents, twenties, tens, fives, ones, quarters, dimes, nickels, pennies;
char repeat;
do
{
inputs(purchase, tendered, change, dollars, cents);
bills(dollars, twenties, tens, fives, ones);
coins(cents, quarters, dimes, nickels, pennies);
output(purchase, tendered, change, twenties, tens, fives, ones, quarters, dimes, nickels, pennies);
cout << "Continue (y or n)? ";
cin >>repeat;
}
while(repeat =='y'  repeat =='Y');
return 0;
}
void inputs(double &purchase, double &tendered, double &change, int &dollars, int ¢s)
{
cout << "\nEnter purchase amount: $" ;
cin >> purchase;
cout << "\nEnter amount tendered: $";
cin >> tendered;
if(tendered > purchase)
{
change = tendered  purchase;
float dollar = floor(change);
dollars = dollar;
cents = (change  dollars)*100;
}
}
void bills(int dollars, int &twenties, int &tens, int &fives, int &ones)
{
twenties = dollars / 20;
dollars %= 20;
tens = dollars / 10;
dollars %= 10;
fives = dollars / 5;
dollars %= 5;
ones = dollars;
}
void coins(int cents, int &quarters, int &dimes, int &nickels, int &pennies)
{
quarters = cents / 25;
cents %= 25;
dimes = cents / 10;
cents %= 10;
nickels = cents / 5;
cents %= 5;
pennies = cents;
}
void output(double purchase, double tendered, double change, int twenties, int tens,int fives,int ones, int quarters, int dimes,int nickels, int pennies)
{
cout<<"Amount of purchase: $" << purchase <<endl;
cout<<"Amount tendered: $" << tendered <<endl;
cout<<"Change due: $" << change <<endl;
cout <<"Bills:" <<endl;
cout << twenties << "  $20's " << tens << "  $10's " << fives << "  $5's " << ones << "  $1's" <<endl;
cout <<"Coins: " <<endl;
cout<< quarters <<"  quarter(s) " << dimes << "  dime(s) " << nickels << "  nickel(s) " << pennies << "  penny(ies)" <<endl;
}
 