#include<iostream>
using namespace std;
class point
{
public:
point(double a, double b,double c,double d);
friend void dist(point*p);
void show();
private:
double u;
double w;
double x;
double y;
double z;
};
point::point(double a, double b, double c, double d )
{
u = a;
w = b;
x = c;
y = d;
}
void dist(point*p)
{
p->z=sqrt((p->u -p->x)*(p->u -p-> x)+(p->w -p->y)*(p->w -p->y));
}
void point::show()
{
cout << "the distance of the two point is:" << z << endl;
}
int main()
{
point chih(8,6,4,2);
point *p;
p = &chih;
chih. show();
}来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/758/viewspace-3120091/ ,如需转载,请注明出处,否则将追究法律责任。