Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include "stdafx.h"
  2.  
  3. using namespace std;
  4. #include <iostream>
  5. #include <iomanip>
  6. #include <cmath>
  7.  
  8. int main()
  9. {
  10. setlocale(LC_ALL, "");
  11.  
  12. float x,y;
  13.  
  14. cout << "Задание #1" << endl;
  15. cout << endl;
  16. cout << "X = ";
  17. cin >> x;
  18.  
  19. if (x >= -10 && x < -8)
  20. {
  21. y = -3;
  22. }
  23. else if (x >= -8 && x < -3)
  24. {
  25. y = (x + 3) / 5 * 3;
  26. }
  27. else if (x >= -3 && x < 3)
  28. {
  29. y = -sqrt(3 * 3 - x * x);
  30. }
  31. else if (x >= 3 && x < 5)
  32. {
  33. y = x - 3;
  34. }
  35. else if (x >= 5 && x <= 8)
  36. {
  37. y = 3;
  38. }
  39.  
  40. cout << "Y = " << fixed << setprecision(1) << y << endl;
  41. cout << endl;
  42. system("pause");
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement