ChameL1oN

Уч_Практика_ЯП_3_задача

Jan 20th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3.  
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. void main(){
  10. int* b = new int[6]; int S; int a[] = { 5000, 1000, 500, 100, 50, 10 };
  11. int i;
  12. setlocale(LC_ALL, "rus");
  13. cout << "Введите сумму" << "\n";
  14. cin >> S;
  15. b[0] = S / a[0];
  16. if (b[0] > 0) cout << b[0] << " Купюр достоинством " << a[0] << "\n";
  17. for (i = 1; S > 0 && i < 7; i++)
  18. {
  19. b[i] = (S%a[i - 1]) / a[i];
  20. if (b[i] != 0) cout << b[i] << " Купюр достоинством " << a[i] << endl;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment