// 设计一个圆形类(Circle),和一个点类(Point),计算点和圆的关系。 class Circle { public: int x; int y; int radius; }; class Point { public: int x; int y; void judge_relation(Circle& c) { int distance = (x - c.x) * (x - c.x) + (y - c.y) * (y - c.y); if (distance == c.radius * c.radius) cout << "点在圆上" << endl; else if (distance > c.radius * c.radius) cout << "点在圆外" << endl; else cout << "点在圆内" << endl; } }; int main() { Circle c1; c1.x = 0; c1.y = 1; c1.radius = 1; Point p1; p1.x = 0; p1.y = 7; p1.judge_relation(c1); return 0; }