Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main() {
- int a;
- int b;
- int c;
- cin >> a;// это колво процентов
- cin >> b;// сумма в рублях
- cin >> c;//сумма копеек
- double k = 1+(a / 100.00); // процент c еденичкой
- c =(b*100)+c; // все бабки в кпейках
- double h = ((c*k) / 100);//целуя часть бабок после умножения на процент
- cout << trunc(h) << endl;// выводит целую часть бабок после умножения на процент
- 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;// тут чекаю в чем траблы
- cout << int((h - int(h)) * 100);//это остаток в копеек
- /*
- пример ввода :
- 13
- 179
- 0
- вывод :
- 202 27
- */
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement