用C/C++语言编一个程序:
指定一个圆心,任意长度自己输入的半径的一个圆,然后求它上面的任意点到圆外点
的长度~~~
解决立即给分!!!
急~~~
感谢~~~
暂时给你一个两点距离的求法程序.
#include <math.h>
class Point
{
public:
Point()
:x(0.0f), y(0.0f)
{
}
Point(float x, float y)
{
this->x = x, this->y = y;
}
friend float _distance(const Point& p1, const Point& p2);
private:
float x;
float y;
};
#define SQR(x) ((x) * (x))
float _distance(const Point& p1, const Point& p2)
{
return sqrt(SQR(p1.x - p2.x) + SQR(p1.y - p2.y));
}
int main()
{
Point x(0.0f, 0.0f);
Point y(1.0f, 1.0f);
float d = _distance(x, y);
return 0;
}