Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5. int main()
  6. {
  7.     double a, b, c, x1, x2, Fx, dx;
  8.     int A, B, C;
  9.     bool G;
  10.     cout << "x1:";
  11.     cin >> x1;
  12.     cout << "x2:";
  13.     cin >> x2;
  14.     cout << "a:";
  15.     cin >> a;
  16.     cout << "b:";
  17.     cin >> b;
  18.     cout << "c:";
  19.     cin >> c;
  20.     cout << "dx:";
  21.     cin >> dx;
  22.     A = a;
  23.     B = b;
  24.     C = c;
  25.     G = (A + B) % 2 || !(c);
  26.     cout << "G:" << G << endl;
  27.     for (double x = x1; x <= x2; x += dx)
  28.     {
  29.         if (c > 0 && x == 0)
  30.         {
  31.             Fx = (x + a) / (c - x);
  32.             cout << "Fx:" << Fx << endl;
  33.         }
  34.         else
  35.         {
  36.             if (c < 0 && x != 0)
  37.             {
  38.                 Fx = (a*pow(x, 3)) - b;
  39.                 cout << "Fx:" << Fx << endl;
  40.             }
  41.             else
  42.             {
  43.                 Fx = a / x;
  44.                 cout << "Fx:" << Fx << endl;
  45.             }
  46.         }
  47.     }
  48.     cin.get();
  49.     cin.get();
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement