I think I'm mostly stuck on the math, but I can't figure out what I'm doing wrong. I'm trying to make a program that will let the user enter an amount of money and get the fewest amount of bills that adds up to the number back. Program doesn't have to be unbreakable and shouldn't take integers but also doesn't tell the user when they entered an integer.
I've looked at videos online, other forums... I just can't find anything that deals with just dollars, not dollars and coins.
The big problem is that this program does tell how much money is needed for each dollar, but the numbers don't consider each other and add up correctly.
double money;
int result;
cout << "Enter a dollar amount: ";
cin >> money;
result = money;
cout << "The fewest number of bills to get " << money << " is:\n";
cout << "=========================================\n";
result = result % 20;
cout << "$20 bills: " << result / 20 << "\n";
result = result % 10;
cout << "$10 bills: " << result / 10 << "\n";
result = result % 5;
cout << "$5 bills : " << result / 5 << "\n";
result = result % 1;
cout << "$1 bills : " << result / 1 << "\n";