rishat06

2_3(a)

Sep 16th, 2025 (edited)
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | Source Code | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     double x;
  6.     cout << "Введите действительное число x: ";
  7.     cin >> x;
  8.    
  9.     double result;
  10.    
  11.     if (x <= -2.0) {
  12.         result = 0.0;
  13.     } else if (x <= 10.0) {
  14.         result = x*x + 4.0*x + 5.0;
  15.     } else {
  16.         result = 1.0/(x*x + 4.0*x - 5.0);
  17.     }
  18.    
  19.     cout << "f(x) = " << result << endl;
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment