I am working on a program for class and just need to be given a push. I have made the script to prompt for the amount needed to be paid and the amount tendered. I just can't figure out how to get the remaining numbers. I don't understand the int, double and float.
Every time I put the modular function, it messes up. I have set every variable to double and named the different types of coins or bills. I am not sure how to make the remainder show up so I can tell the user how many dollars, quarters, dimes and so on they need to give to the customer. Let me know if you need anything more information. I don't mean for you to do it for me but point me in the right direction. Thank you.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
double C; //Change
double DR = 1.00; //Dollars
double Q = 0.25; //Quarters
double D = 0.10; //Dimes
double N = 0.05; //Nickels
double P = 0.01; //Pennies
double AD = 0.00; //Amount Due
double AT = 0.00; //Amount Tendered
double DRC = 0.00;//Dollars
double DRCR = 0.00;//Quarters Left
cout <<"Enter amount customer owes: ";
cin >> AD;
cout <<"Enter amount tendered: ";
cin >> AT;
C = (AT - AD);
cout <<"Change due is: "<<C<<"\n\n\n";
DRC = (C % DR);//Remainder
//DRCR = (C % DRC);//Extract Remainder
cout <<"You need to give the customer "<<DRC<<" Remainder.\n\n\n";
cout <<"You need to give the customer "<<DRCR<<" Remainder.\n\n\n";
system ("pause");
}

New Topic/Question
Reply



MultiQuote




|