Advertisement
RadioNurshat

Задачи по программированию

Sep 16th, 2020
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. bool a(int x, int y) {
  5.     return ((y <= -x + 1) && (y <= x + 1) && (y >= x - 1) && (y >= -x - 1));
  6. }
  7. bool b(int x, int y) {
  8.     return ((y <= exp(x)) && (y <= (exp(-x))) && (y >= pow(x, 2) - 1));
  9. }
  10. bool c(int x, int y) {
  11.     return (((x <= -2) || (x >= 2)) && (y >= 2) || ((x < 2) && (x > -2)) && (y >= abs(x)));
  12. }
  13. bool d(int x, int y) {
  14.     return (((y >= 0) && (pow(x, 2) + pow(y, 2) >= 2.25) && (pow(x, 2) + pow(y, 2) <= 9)) || ((y <= 0) && (pow(x, 2) + pow(y, 2) < 9)));
  15. }
  16. bool e(int x, int y) {
  17.     return ((y >= 0) && (y >= x) && (y >= -2 * x) && (pow(x, 2) + pow(y, 2) <= 4));
  18. }
  19. string resultEnterpreter(bool x) {
  20.     if (x) {
  21.         return "Включена";
  22.     }
  23.     else {
  24.         return "Не включена";
  25.     }
  26. }
  27. int main() {
  28.     setlocale(LC_ALL, "Russian");
  29.     int x; int y;
  30.     cout << "Введите x,y для проверки с 'а' по 'д'" << endl;
  31.     cin >> x;
  32.     cin >> y;
  33.  
  34.     cout << "A: " << resultEnterpreter(a(x, y)) << endl;
  35.     cout << "Б: " << resultEnterpreter(b(x, y)) << endl;
  36.     cout << "В: " << resultEnterpreter(c(x, y)) << endl;
  37.     cout << "Г: " << resultEnterpreter(d(x, y)) << endl;
  38.     cout << "Д: " << resultEnterpreter(e(x, y)) << endl;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement