重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
#include
using namespace std;
class point {
public:
void set_x(int x) {
m_x = x;
}
void set_y(int y) {
m_y = y;
}
int show_x() {
return m_x;
}
int show_y() {
return m_y;
}
private:
int m_x;
int m_y;
};
class circle {
public:
void set_r(int r) {
m_r = r;
}
int show_r() {
return m_r;
}
void set_center(point center) {
m_center = center;
}
point show_center() {
return m_center;
}
private:
int m_r;
point m_center;
};
void isornot(circle& c, point& a) {
int distance1 = (a.show_x() - c.show_center().show_x()) * (a.show_x() - c.show_center().show_x()) + (a.show_y() - c.show_center().show_y()) * (a.show_y() - c.show_center().show_y());
int distance2 = (c.show_r()) * (c.show_r());
if (distance1< distance2) {
cout<< "点在圆内"<< endl;
}
else if (distance1 == distance2) {
cout<< "点在圆上"<< endl;
}
else {
cout<< "点在圆外"<< endl;
}
}
int main() {
circle c;
c.set_r(5);
point center;
center.set_x(5);
center.set_y(0);
c.set_center(center);
point a;
a.set_x(10);
a.set_y(0);
isornot(c, a);
system("pause");
return 0;
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧