#include <iostream>
#include<math.h>
using namespace std;
class Point
{
private:
double x,y,z;
public:
Point(double a,double b,double c):x(a),y(b),z(c)
{

}
Point(){};
~Point()
{

}
void set_x_y_z(int a,int b,int c){x = a; y = b; z = c;}
void set_x_y(int a,int b){x = a; y = b;}
double X(){return x;}
double Y(){return y;}
double Z(){return z;}

};
double distance_between_two_point(Point a, Point b)
{
return sqrt(pow(a.X()-b.X(),2)+pow(a.Y()-b.Y(),2) + pow(a.Z()-b.Z(),2));
}
int main()
{
Point a(0,0,0),b(0,0,0);
double x1,x2,y1,y2;
cin>>x1>>y1>>x2>>y2;
a.set_x_y(x1,y1);
b.set_x_y(x2,y2);
cout<<distance_between_two_point(a,b)<<endl;


return 0;
}

猜你喜欢

转载自www.cnblogs.com/zhang-zsq/p/12562298.html