Advertisement
MadCortez

Untitled

Sep 23rd, 2020
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     setlocale(LC_ALL, "Russian");
  9.     double x, y, f, a, s;
  10.     int k;
  11.     cout << "Введите х: ";
  12.     cin >> x;
  13.     cout << "Введите y: ";
  14.     cin >> y;
  15.     cout << "Выберите f: 1 - sh(x), 2 - x^2, 3 - exp(x): ";
  16.     cin >> k;
  17.     switch (k) {
  18.     case 1: f = sinh(x);
  19.         break;
  20.     case 2: f = pow(x, 2);
  21.         break;
  22.     case 3: f = exp(x);
  23.         break;
  24.     default: cout << "Не выбрана функция";
  25.         return 1;
  26.     }
  27.     a = x - y;
  28.     if (a == 0)
  29.         s = pow(f, 2) + pow(f, 1/3.0) + sin(y);
  30.     else
  31.         if (a > 0)
  32.             s = pow(f - y, 2) + log(x);
  33.         else
  34.             s = pow(y - f, 2) + tan(y);
  35.     cout << "Результат = " << s;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement