I need some small help hopefully. I thought i could figure this out on my own but obviously since i am posting to this board for the first time, well you know.
I am trying to get this program to calculate change tendered by breaking it down by dollars, half-dollars, quarters, dimes, nickels, and pennies. Reliaze this is just the beginning of the class so not allowed to use loops, modulus, etc.. this is why i am stuck.
Code:
#include <iostream>// cin, cout, <<, >>
using namespace std;
int main()
{
cout << "Enter the amount of purchase" <<"\n";
double purchaseAmt;
cin >> purchaseAmt;
cout << "Enter your payment amount given" <<"\n";
double paymentAmt;
cin >> paymentAmt;
double changeAmt = paymentAmt - purchaseAmt;
cout << "\nYour change back is: " << changeAmt << "\n";
double halfDollar = changeAmt / .50;
double quarters = changeAmt / .25;
double dimes = changeAmt / .10;
double nickels = changeAmt / .5;
double pennies = changeAmt;
cout << "\nhalfDollar back: " << halfDollar << "\n";
cout << "\nQuarters back: " << quarters << "\n";
cout << "\nDimes back: " << dimes << "\n";
cout << "\nNickels back: " << nickels << "\n";
return 0;
}