问题描述
有一个圆,圆心坐标是(0,0),半径r=4.5,任意输入一个点的坐标(x,y),判断这个点是在圆内,圆周上,还是在圆外
输入
两个浮点数x,y
输出
如果在圆内,输出in
如果在圆外,输出out
如果在圆上,输出on
样例输入
1.0 1.0
样例输出
in
AC代码
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float x,y;
float s = 4.5;
cin >> x >> y;
if(sqrt((x*x) + (y*y)) < s)
{
cout << "in" << endl;
}
else if(sqrt((x*x) + (y*y)) == s)
{
cout << "on" << endl;
}
else
{
cout << "out" << endl;
}
return 0;
}