​Task7-Distance between points-solution


#include < stdio.h >
#include< math.h >
using namespace std;
int main()
{
  double Ax,Ay,Bx,By;
  double d;
  scanf("%lf%lf%lf%lf",&Ax,&Ay,&Bx,&By);
  d=sqrt(pow(Bx-Ax,2) + pow(By-Ay,2));
  printf("%.5f",d);
  return 0;
}
Explanation:
​
The distance between the two points is calculated according to the Pythagorean theorem for the triangle of which the cathets (x2-x1) and (y2-y1)

d2 = (x2-x1)2 + (y2-y1)2
d = sqrt (pow (x2-x1) + pow (x2-x1)), where functions from math are used
For quadrature: pow (a, b) where a is the basis of the degree and b is the exponent of the degree
For rooting: sqrt (a) where a is a sized size​