distance function

double distance(
  1. double x1,
  2. double y1,
  3. double x2,
  4. double y2,
)

Implementation

double distance(double x1, double y1, double x2, double y2) {
  var a = x1 - x2;
  var b = y1 - y2;

  return sqrt(pow(a, 2) + pow(b, 2));
}