This program calculates the least amount of change a person can give. For example if I would type in $26.50 it would print out -
Twenties-1
Fives- 1
Loonies-1
Quarters-2
Also for the bills and coins not used how would I get the to not show instead of the giving me zeros.
Twenties-1
Fives- 1
Loonies-1
Quarters-2
Also for the bills and coins not used how would I get the to not show instead of the giving me zeros.
#include <iostream>
using namespace std;
const int FIFTIES = 5000;
const int TWENTIES = 2000;
const int TENS = 1000;
const int FIVES = 500;
const int TWOS = 200;
const int ONES = 100;
const int QUARTER = 25;
const int DIME = 10;
const int NICKEL = 5;
const int PENNIES_TO_DOLLAR = 100;
int main()
{
int DollarAmt, DecimalAmt;
char DecimalPoint;
int TotalMoneyInPennies;
cout<<"This program will convert a total amount of money into denominations of money to make change."<<endl;
cout<<"Input the total here: ";
cin>> DollarAmt >> DecimalPoint >> DecimalAmt;
cout<<endl;
TotalMoneyInPennies = DecimalAmt + (DollarAmt * PENNIES_TO_DOLLAR);
cout<<"You input: $"<< DollarAmt << DecimalPoint << DecimalAmt<<endl;
cout<<"This is a total of " <<TotalMoneyInPennies <<" pennies."<<endl;
cout<<"Your denominations would be: "<<endl;
cout<< "Fifties: "<<TotalMoneyInPennies/FIFTIES<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % FIFTIES;
cout<< "Twenties: "<<TotalMoneyInPennies/TWENTIES<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % TWENTIES;
cout<< "Tens: "<<TotalMoneyInPennies/TENS<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % TENS;
cout<< "Fives: "<<TotalMoneyInPennies/FIVES<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % FIVES;
cout<< "Twos: "<<TotalMoneyInPennies/TWOS<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % TWOS;
cout<< "Ones: "<<TotalMoneyInPennies/ONES<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % ONES;
cout<< "Quarters: "<<TotalMoneyInPennies/QUARTER<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % QUARTER;
cout<< "Dimes: "<<TotalMoneyInPennies/DIME<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % DIME;
cout<< "Nickels: "<<TotalMoneyInPennies/NICKEL<<endl;
TotalMoneyInPennies = TotalMoneyInPennies % NICKEL;
cout<< "Pennies: "<<TotalMoneyInPennies<<endl;
system ("pause");
}