Sitisom

1.1

Oct 16th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5.  
  6. double func(float a, float x) {
  7.     double F;
  8.     F = (1. - a)*sin(a*a + a * x + 2.) / (1. + x * x);
  9.     return F;
  10. }
  11. int main()
  12. {
  13.     float h, b, a,x = 0;
  14.     int n;
  15.     double prom, ymin, ymax;
  16.    
  17.     cout << "h= "; cin >> h;
  18.     cout << "b= "; cin >> b;
  19.     cout << "n= "; cin >> n;
  20.  
  21.     for (int i = 0; i < 3; i++) {
  22.         ymin = 100000;
  23.         ymax = -100000;
  24.         cout << "a= "; cin >> a;
  25.         for (int j = 1; j <= n; j++) {
  26.             x =b + (j * h);
  27.             prom = func(a, x);
  28.             if (ymin > prom) ymin = prom;
  29.             if (ymax < prom) ymax = prom;
  30.            
  31.         }
  32.         cout << ymin << endl << ymax << endl;
  33.     }
  34.     system("pause");
  35.     return 0;
  36. }
Add Comment
Please, Sign In to add comment