Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- double x, y, f, a, s;
- int k;
- cout << "Введите х: ";
- cin >> x;
- cout << "Введите y: ";
- cin >> y;
- cout << "Выберите f: 1 - sh(x), 2 - x^2, 3 - exp(x): ";
- cin >> k;
- switch (k) {
- case 1: f = sinh(x);
- break;
- case 2: f = pow(x, 2);
- break;
- case 3: f = exp(x);
- break;
- default: cout << "Не выбрана функция";
- return 1;
- }
- a = x - y;
- if (a == 0)
- s = pow(f, 2) + pow(f, 1/3.0) + sin(y);
- else
- if (a > 0)
- s = pow(f - y, 2) + log(x);
- else
- s = pow(y - f, 2) + tan(y);
- cout << "Результат = " << s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement