#include struct Point { private: double X; double Y; public: Point(double x, double y) { UpdatePoint(x, y); } Point() { UpdatePoint(0, 0); } void UpdatePoint(double x, double y) { this->X = x; this->Y = y; } Point GetPoint() { return Point(this->X, this->Y); } double GetPointX() const { return this->X; } double GetPointY() const { return this->Y; } }; std::ostream& operator << (std::ostream& stream, const Point& p) { std::cout << "Point X: " << p.GetPointX() << "\nPoint Y: " << p.GetPointY() << std::endl; return stream; } std::istream& operator >> (std::istream& stream, Point& p) { std::cout << "Enter two numbers (x; y)" << std::endl; int x, y; std::cin >> x >> y; p.UpdatePoint(x, y); return stream; } int main() { // settings const bool isBorderCount = false; // считается ли граница за попадание const double borderWidth = isBorderCount == true ? 0.01 : 0; // ширина границы const double circleRadius = 2; // радиус круга, в который должна попасть точка const double squareHalfSize = 1; // радиус круга вписаного в квадрат // main code Point inputPoint; std::cin >> inputPoint; double r_xy = sqrt(inputPoint.GetPointX() * 2 + inputPoint.GetPointY() * 2); if (r_xy <= circleRadius - borderWidth) //точка входит в круг { if (abs(0 - inputPoint.GetPointX()) > squareHalfSize || abs(0 - inputPoint.GetPointY()) > 1) { std::cout << "Your point is in area" << std::endl; // точка в заштрихованой зоне } else { std::cout << "Your point is in square" << std::endl; // точка в незаштрихованой зоне } } else { std::cout << "Your point isn`t in the circle" << std::endl; } system("pause"); return 0; }