The program is suppose to ask the user to enter an amount that's a multiple of 10, and then display the amount using the least number of bills, which are 10s, 20s, and 50s. I don't what to use to get the least number of bills. Should I use a loop, if statement?
CODE
#include <iostream>
using namespace std;
int dispense(int amount, int *ten, int *twenty, int *fifty);
int main()
{
int amt;
int tens;
int twenties;
int fifties;
cout << "Enter the amount desired (must be a multiple of 10 dollars) : ";
cin >> amt;
dispense(amt, &tens, &twenties, &fifties);
cout << "Number of fifties : " << fifties << "\n";
cout << "Number of twenties : " << twenties << "\n";
cout << "Number of Tens : " << tens << "\n";
return 0;
}
int dispense(int amount, int *ten, int *twenty, int *fifty)
{
*fifty = amount/50;
*twenty = amount/ 20;
*ten = amount/10;
}