头文件名:hanshu.h
#include"iostream"
#include"math.h"
using namespace std;
class TwoCoor{
private:
double x,y;
public:
TwoCoor* operator+(TwoCoor t)
{
TwoCoor *p;
p=new TwoCoor;
p->x=this->x+t.x;
p->y=this->y+t.y;
return(p);
}
TwoCoor* operator-(TwoCoor t)
{
TwoCoor *p;
p=new TwoCoor;
p->x=this->x-t.x;
p->y=this->y-t.y;
return(p);
}
double diatance(TwoCoor);
friend void operator<<(ostream &os,TwoCoor &t)
{
os << "(" << t.x << "," << t.y << ")" << endl ;
}
friend void operator>>(istream &is,TwoCoor &t)
{
cout << "请输入坐标值:" << endl;
is >> t.x ;
is >> t.y ;
}
};
double TwoCoor::diatance(TwoCoor b)
{
double d;
d=sqrt(pow((this->x-b.x),2)+pow(this->y-b.y,2));
return