artemgf

Тем ниже Приоры

May 1st, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <math.h>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <set>
  8. #include <map>
  9. #include <sstream>
  10. #include <queue>
  11. #include <stdint.h>
  12.  
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17.     double fightmoney, sevmoney, plusmpney, year, procent, dtp, undtp, del;
  18.  
  19.     cin >> fightmoney;
  20.     cin >> sevmoney >> plusmpney;
  21.     cin >> year >> procent;
  22.  
  23.     cout.setf(ios::fixed);
  24.     cout.precision(6);
  25.     dtp = ((((2 * (sevmoney + plusmpney) + (year - 1)*plusmpney)) / 2.0)*year)*(1 + procent / 100.0);
  26.     undtp = (((2 * (sevmoney+ plusmpney) + (year-1)*plusmpney)) / 2.0)*year+fightmoney;
  27.     del = abs(dtp - undtp);
  28.     if (dtp>undtp&&del>0.000001)
  29.     {
  30.         cout << "Cash" << endl;
  31.         cout << del;
  32.     }
  33.     else
  34.     {
  35.         cout << "Insurance" << endl;
  36.         cout << del;
  37.     }
  38.  
  39.  
  40.     _getch();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment