Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <clocale>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. setlocale(LC_ALL, "russian");
  10. double x, y;
  11.  
  12. cout << "Введите х: ";
  13. cin >> x;
  14. cout << "\nx = " << x;
  15.  
  16. if (x <= -2)
  17.     y = 0;
  18. else if (x <= 0)
  19.     y = x * x - 4;
  20. else if (x <= 2)
  21.     y = x * 2 - 4;
  22. else y = 0;
  23. cout << "\ny = "<< y;
  24.  
  25.  
  26. system("pause");
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement