// 点和圆的关系
#include <iostream>
#include <cmath>

using namespace std;

enum Pos_e
{
    onCircle = 4, // 点在圆上
    inCircle,     // 点在圆内
    outCircle     // 点在圆外
};

class Point
{
public:
    int x, y;
};

class AdvCircle
{
public:
    int init(int x0, int y0, int r)
    {
        this->r = r;
        o.x = x0;
        o.y = y0;
    }

    Pos_e at(Point &point);

private:
    int r;
    Point o; // 圆心点
};

Pos_e AdvCircle::at(Point &point)
{
    int distence = pow((point.x - this->o.x), 2) + pow((point.y - this->o.y), 2);
    int rr = r * r;
    if (distence == rr)
    {
        return onCircle;
    }
    else if (distence < rr)
    {
        return inCircle;
    }
    else
        return outCircle;
}

string posToString(Pos_e pos)
{
    switch (pos)
    {
    case onCircle:
        return "在圆上";
        break;
    case inCircle:
        return "在圆内";
        break;
    case outCircle:
        return "在圆外";
        break;
    default:
        break;
    }
}

int main()
{
    AdvCircle c1;
    c1.init(0, 0, 2);

    Point p1;
    p1.x = 1;
    p1.y = 1;

    cout << "c1.at(p1) " << posToString(c1.at(p1)) << endl;

    return 0;
}
