1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <string>
using namespace std;
void Disburse (int & euros, int val, const string & descr)
{ int num;
num = euros / val;
cout << "Pay: " << num << " " << descr << endl;
euros -= num * val;
}
int main()
{ int euros;
cout << "Enter total amount in Euros: ";
cin >> euros;
Disburse (euros, 500, "five-hundred notes");
Disburse (euros, 200, "two-hundred notes");
Disburse (euros, 100, "one-hundred notes");
Disburse (euros, 50, "fifty notes");
Disburse (euros, 20, "twenty notes");
Disburse (euros, 10, "ten notesn");
Disburse (euros, 5, "five notes");
Disburse (euros, 2, "two coins");
Disburse (euros, 1, "one coins");
system("pause");
return 0;
}
|