#include <iostream> #include <string> using std::cin; using std::cout; using std::string; int main() { float x = 0, y = 0; const string MSG_BELONG = "\nthe point with coordinates x, y belongs to the plane\n"; const string MSG_NOT_BELONG = "\nthe point with coordinates x, y does not belongs to the plane\n"; cout << "Enter X: "; cin >> x; cout << "Enter Y: "; cin >> y; cout << "\n1 option ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0))"; if ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n2 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2\n"; float radius = x * x + y * y; if ((radius <= 1.0f) && (radius >= 0.5f)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n3 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2 && y >= 0\n"; radius = x * x + y * y; if ((radius <= 2.0f) && (radius >= 2.5f) && (y >= 0)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n4 option ((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0)\n"; if (((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0)) { cout << MSG_BELONG; } else if (((x > -1) && (x <= 0)) && (y >= -1.0 * x)) { cout << MSG_BELONG; } else if (((x > 0) && (x < 1)) && (y >= x)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------"; std::getchar(); return 0; } C #include <iostream> #include <string> using std::cin; using std::cout; using std::string; int main() { float x = 0, y = 0; const string MSG_BELONG = "\nthe point with coordinates x, y belongs to the plane\n"; const string MSG_NOT_BELONG = "\nthe point with coordinates x, y does not belongs to the plane\n"; cout << "Enter X: "; cin >> x; cout << "Enter Y: "; cin >> y; cout << "\n1 option ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0))"; if ((x >= -1.0 && x <= 1.0) && (y >= -1.0 && y <= 1.0)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n2 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2\n"; float radius = x * x + y * y; if ((radius <= 1.0f) && (radius >= 0.5f)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n3 option x1^2 + y1^2 < R1 && x2^2 + y2^2 > R2 && y >= 0\n"; radius = x * x + y * y; if ((radius <= 2.0f) && (radius >= 2.5f) && (y >= 0)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------\n"; cout << "\n4 option ((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0)\n"; if (((x <= -1.0f) || (x >= 1.0f)) && (y >= 1.0)) { cout << MSG_BELONG; } else if (((x > -1) && (x <= 0)) && (y >= -1.0 * x)) { cout << MSG_BELONG; } else if (((x > 0) && (x < 1)) && (y >= x)) { cout << MSG_BELONG; } else { cout << MSG_NOT_BELONG; } cout << "------------------------------------------"; std::getchar(); return 0; }