/*
 * dist.c
 * This program read two points and computes the distance between them.
 */

#include <stdio.h>
#include <math.h>

int main ()
{
  double    x1, y1;           /* The coordinates of the first point. */
  double    x2, y2;           /* The coordinates of the second point. */
  double    dist;

  /* Read the two points. */
  printf ("Please enter the first point: ");
  scanf ("%lf %lf", &x1, &y1);

  printf ("Please enter the second point: ");
  scanf ("%lf %lf", &x2, &y2);

  /* Compute the distance between these points:
   *             ________________________
   *            /         2            2
   *   dist = \/ (x2 - x1)  + (y2 - y1)
   */
  dist = sqrt ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));

  printf ("dist((%g,%g),(%g,%g)) = %g\n", x1, y1, x2, y2, dist);

  return (0);
}

