#include <iostream>
#include<cmath>
using namespace std;
class point
{
double x,y;
public:
point(double x1,double y1);
friend void showpoint(point &a,point &b);
double get_x();
double get_y();
};
point::point(double x1,double y1)
{
x=x1;y=y1;
}
double point::get_x()
{
return x;
}
double point::get_y()
{
return y;
}
void showpoint(point &a,point &b)
{
double S;
S=sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
cout<<"两点的距离为:"<<S<<endl;
}
int main()
{
point P1(3,4);
point P2(0,0);
cout<<"A("<<P1.get_x()<<","<<P1.get_y()<<")"<<endl;
cout<<"B("<<P2.get_x()<<","<<P2.get_y()<<")"<<endl;
showpoint(P1,P2);
return 0;
}
11-15
11-15
11-15
11-15
07-24