#include <iostream>
using namespace std;
#include<cmath>
#include"time_user.h"
class point
{
private:
int x, y, z;
public:
void set()
{
cin >> x >> y >> z;
}
void out()
{
cout << "x: " << x << " y: " << y << " z " << endl;
}
int xget()
{
return x;
}
int yget()
{
return y;
}
int zget()
{
return z;
}
};
float d(point& p)
{
return sqrt(p.xget() * p.xget() + p.yget() * p.yget() + p.zget() * p.zget());
}
int main()
{
point p1;
p1.set();
p1.out();
cout << "到原点的距离:" << d(p1) << endl;
}
标签:p1,return,point,int,yget,5.15,include From: https://www.cnblogs.com/lml66/p/17403408.html