Advertisement
Lavig

Підсумковий контроль (Завдання 1)

Dec 13th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     double x{}, result{};
  9.     SetConsoleOutputCP(1251);
  10.     while (true) {
  11.         cout << "Введіть значення x: ";
  12.         cin >> x;
  13.         if (cin.fail()) {
  14.             cin.clear();
  15.             cin.ignore(32767, '\n');
  16.             cout << "Число було введено неправильно. Спробуйте ще раз!" << endl;
  17.             continue;
  18.         }
  19.         else {
  20.             break;
  21.         }
  22.     }
  23.     result = cos(pow(x, 2.4) + 1) - fabs(sin(2 * x) - 5.76);
  24.     cout << "Значення виразу: " << result;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement