#include <iostream>
#include <cmath>
using namespace std;
double f1(double x1,double y1,double z1,double x2=0,double y2=0,double z2=0);
double g1(double a,double b)
{
return (a-b)*(a-b);
}
int main()
{
double a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
cout<<f1(a,b,c)<<endl;
cout<<f1(a,b,c,d,e,f);
return 0;
}
double f1(double x1,double y1,double z1,double x2,double y2,double z2)
{
double sum ;
sum=g1(x1,x2)+g1(y1,y2)+g1(z1,z2);
return sqrt(sum);
}
代码编写不易,如果对您有帮助,谢谢您的点赞支持~