Advertisement
Pandarec13

kkk

Oct 25th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5. int main() {
  6. int a;
  7. int b;
  8. int c;
  9.  
  10. cin >> a;// это колво процентов
  11. cin >> b;// сумма в рублях
  12. cin >> c;//сумма копеек
  13.  
  14. double k = 1+(a / 100.00); // процент c еденичкой
  15.  
  16. c =(b*100)+c; // все бабки в кпейках
  17.  
  18. double h = ((c*k) / 100);//целуя часть бабок после умножения на процент
  19.  
  20. cout << trunc(h) << endl;// выводит целую часть бабок после умножения на процент
  21.  
  22. cout << " h= " << h << " int (h)= " << int(h) << " h-int (h)= " << h - int(h) << " ((h-int (h))*100)= " << ((h - int(h))*100) << " int ((h-int (h))*100)= " << int((h - int(h)) * 100)<< endl;// тут чекаю в чем траблы
  23.  
  24. cout << int((h - int(h)) * 100);//это остаток в копеек
  25.  
  26. /*
  27. пример ввода :
  28. 13
  29. 179
  30. 0
  31. вывод :
  32. 202 27
  33. */
  34.  
  35.  
  36.  
  37.  
  38. system("pause");
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement