#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<< "點在圓內(nèi)"<< 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;
}
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧