#include
#include
class point
{
double x,y;
public:
point (double x0=0, double y0=0)
{x=x0; y=y0;}
point operator + (point pt2);
double operator ^ (point pt2);
void display();
};
point::point(double x0,double y0)
{
x=x0;
y=y0;
}
point point::operator +(point pt2)
{
point p;
p.x=x+pt2.x;
p.y=y+pt2.y;
return p;
}
point point::operator ^(point pt2)
{
point p;
p.x=(x-pt2.x)*(x-pt2.x);
p.y=(y-pt2.y)*(y-pt2.y);
return sqrt(x+y);
}
void point::display()
{
cout//using namespace std;//class point { double x,y;public: point (double x0=0, double y0=0)//函数“point::point(double,double)”已有主体,所以删了下面一段 {x=x0; y=y0; }point operator + (point pt2); double operator ^ (point pt2); void display();};point point::operat
|