Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 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 s1, s2, s, x, y;
  11. int res = 0;
  12. s1 = 3.14 * 3 * 3;
  13. s2 = 3.14 * 1.5 * 1.5;
  14. s = s1 - s2;
  15. cout << "Введите координаты точки (x, y): " << endl;
  16. cin >> x >> y;
  17. cout << "x = " << x << ", y =" << y << endl;
  18. if (((x >= -3 && x <=0 && y <= 0)  || (x >= 0 && x <= 3 && y >= 0)) && (x * x + y * y > s2 / 2))
  19.     res++;
  20. else if ((x >= -3 && x <= 0 && y >= 0) || (x >= 0 && x <= 3 && y <= 0))
  21.     res++;
  22. if (res == 1)
  23.     cout << "Площадь заштрихованной фигуры равна: " << s << endl;
  24. else
  25.     cout << "Координаты не попадают в заштрихованную фигуру" << endl;
  26.    
  27. system("pause");
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement