|
-
February 12th, 2003, 04:50 AM
#1
problem with my program C++
I'm having trouble comeing up with a solution, I need to make a program that will calculate what was owed with how much was paided and show the change due back but also it needs to show exactly how many dollars, quarters, dimes, nickels, and pennies the person will get back.
My program shows how much thats equal to in dollars, quarters, dimes, nickels, and pennies. Can someone help me.
# include <iostream>
using namespace std;
int main ()
{
double owes, paid, change;
double dol = 1.00;
double qua = 0.25;
double dim = 0.10;
double nic = 0.05;
double pen = 0.01;
cout << "Enter amount owed: $";
cin >> owes;
cout << "Enter amount paid: $";
cin >> paid;
change = paid - owes;
dol = change / dol;
qua = change / qua;
dim = change / dim;
nic = change / nic;
pen = change / pen;
cout << "Your change is $" << change << endl;
cout << "That's equal to " << dol << " Dollars, " << qua << " Quarters, "
<< dim << " Dimes, " << nic << " Nickels, " << pen << " Pennies, " << endl;
return 0;
}
Thanks for helping me out.
S25vd2xlZGdlIGlzIHBvd2VyIQ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|