Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int main(int argc, char *argv[])
- {
- //tablica dostepnych nominalow
- double N[14]={20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
- int R,P, i;
- double x;
- cout << "Podaj reszte do wyplacenia: ";
- cin >> x;
- R=x*100;
- i=0;
- while (R>0)
- {
- if (R >= N[i])
- {
- P=R / N[i];
- R=R-(N[i]*P);
- cout << N[i]/100 << " x " << P << endl;
- }
- i++;
- }
- system("PAUSE");
- return 0;
- }
Add Comment
Please, Sign In to add comment