#include<iostream>
#include<Cmath>
using namespace std;
class CPoint
{
private:
double x;
double y;
public:
CPoint(double xx,double yy):x(xx),y(yy){}
double getx()
{
return x;
}
double gety()
{
return y;
}
};
void distance1(CPoint &,CPoint &);
void distance1(CPoint &t1,CPoint &t2)
{
double l;
l=sqrt((t1.getx()-t2.getx())*(t1.getx()-t2.getx())+(t1.gety()-t2.gety())*(t1.gety()-t2.gety()));
cout<<l;
}
int main()
{
CPoint t1(1,2),t2(2,3);
distance1(t1,t2);
return 0;
}
一般函数
最新推荐文章于 2019-07-23 13:46:02 发布