Could someone give me help on how to simplify this? Trying to write code to solve this equation:
Distance = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
I subbed a,b,c as the second set of coords. Im probably using too many vars as weel but im new, give it some time.
void school(int x,int y,int z, int a,int b,int c);
int main()
{int a,b,c,x,y,z;
cout<< "enter coordinates plz"<<endl;
cin>>x>>y>>z>>a>>b>>c;
school(x,y,z,a,b,c);
return 0;
}
void school(int x,int y,int z,int a,int b,int c)
{float d,e,f,g,h;
d=x-a;
e=y-b;
f=z-c;
g=powf(d,2)+powf(e,2)+powf(f,2);
h=sqrtf(g);
cout<<"the answer is "<<h;
}