// point.h
#pragma once // 防止头文件重复包含

#include <iostream>

using namespace std;


class Point {

public:
void setX(int x);

int getX();

void setY(int y);

int getY();


private:
int m_X;
int m_Y;
};
// point.cpp
#include "point.h"


void Point::setX(int x) {
this->m_X = x;
}

int Point::getX() {
return this->m_X;
}

void Point::setY(int y) {
this->m_Y = y;
}

int Point::getY() {
return this->m_Y;
}
// circle.h
#pragma once // 防止头文件重复包含

#include <iostream>
#include "point.h"

using namespace std;


class Circle {

public:

void setR(int r);

int getR();

void setCenter(Point point);

Point getCenter();

bool pointIsInCircle(Point point);

private:
int m_R; // 半径
Point m_Center;
};
// circle.cpp
#include "circle.h"

void Circle::setR(int r) {
this->m_R = r;
}

int Circle::getR() {
return this->m_R;
}

void Circle::setCenter(Point point) {
this->m_Center = point;
}

Point Circle::getCenter() {
return this->m_Center;
}

bool Circle::pointIsInCircle(Point point) {
double distance = sqrt(pow(this->getCenter().getX() - point.getX(), 2) + pow(this->getCenter().getY() - point.getY(), 2));

if (distance == this->getR()) {
printf("点 在 圆上 \n");
}
else if (distance > this->getR()) {
printf("点 在 圆外 \n");
}
else if (distance < this->getR()) {
printf("点 在 圆内 \n");
}
else {
printf("这是个 什么 妖魔鬼怪? \n");
}

return distance < this->getR();
}
// C++ 的 .cpp文件
#include <iostream>

#include "point.h"
#include "circle.h"

using namespace std;

bool isInCircle(Circle& circle, Point& point) {
Point circleCenter = circle.getCenter();

float distance = sqrt(pow(circleCenter.getX() - point.getX(), 2) + pow(circleCenter.getY() - point.getY(), 2)); // pow 平方, sqrt 开根号

if (distance == circle.getR()) {
printf("点 在 圆上 \n");
} else if(distance > circle.getR()) {
printf("点 在 圆外 \n");
} else if (distance < circle.getR()) {
printf("点 在 圆内 \n");
} else {
printf("这是个 什么 妖魔鬼怪? \n");
}

return distance < circle.getR();
}


void test01() {
// 全局变量来判断
Point point;
point.setX(10);
point.setY(10);

Circle circle;
Point center;
center.setX(10);
center.setY(0);
circle.setCenter(center);
circle.setR(10);

isInCircle(circle, point);
}


void test02() {

Point point;
point.setX(10);
point.setY(10);

Circle circle;
Point center;
center.setX(10);
center.setY(0);
circle.setCenter(center);
circle.setR(10);

circle.pointIsInCircle(point);
}


int main() {

test01();

//test02();

return EXIT_SUCCESS;
}