Advertisement
Risonna

lab2_n4

Oct 27th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. float mind(float x, float y, float z)
  5. {
  6.     float s;
  7.     s = x;
  8.     if (y < s)
  9.     {
  10.         s = y;
  11.         if (z < s)
  12.         {
  13.             s = z;
  14.         }
  15.     }
  16.     return s;
  17. }
  18. float maxd(float x, float y)
  19. {
  20.     float s;
  21.     s = x;
  22.     if (y > s)
  23.     {
  24.         s = y;
  25.     }
  26.     return s;
  27. }
  28.  
  29. int main()
  30. {
  31.     float T, x, y, a, b;
  32.     int z;
  33.     cout << "a="; cin >> a;
  34.     cout << "b="; cin >> b;
  35.     x = (a * a) - 1;
  36.     y = (b * b) - (a * a);
  37.     z = sqrt(fabs(a + b));
  38.     cout << "x=" << x << "\n";
  39.     cout << "y=" << y << "\n";
  40.     cout << "z=" << z << "\n";
  41.     cout << "Минимум из x, y, z=" << mind(x, y, z) << "\n";
  42.     cout << "Максимум из x, y=" << maxd(x, y) << "\n";
  43.     if (fabs(x) + mind(x, y, z) != 0 && fabs(y)+maxd(x, y) != 0)
  44.     {
  45.         T = (fabs(x) + mind(x, y, z)) / (fabs(y) + maxd(x, y));
  46.         cout << "T=" << T << "\n";
  47.     }
  48.     else
  49.     {
  50.         cout << "Либо знаменатель, либо числитель равняется нулю, вычисление Т невозможно\n";
  51.     }
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement