Guest User

Untitled

a guest
Nov 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. //tablica dostepnych nominalow
  9. double N[14]={20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
  10. int R,P, i;
  11. double x;
  12.  
  13. cout << "Podaj reszte do wyplacenia: ";
  14. cin >> x;
  15. R=x*100;
  16. i=0;
  17. while (R>0)
  18. {
  19. if (R >= N[i])
  20. {
  21. P=R / N[i];
  22. R=R-(N[i]*P);
  23. cout << N[i]/100 << " x " << P << endl;
  24. }
  25. i++;
  26. }
  27.  
  28. system("PAUSE");
  29. return 0;
  30. }
Add Comment
Please, Sign In to add comment