Calculate the distance between two points problem description enter two point coordinate (x1,y1), (x2,y2), calculate and output the distance between two points.
Input data has more than one group, each group of one row, consisting of 4 real numbers, representing X1,y1,x2,y2, separated by a space between the data.
Output outputs a row for each set of input data, and the result retains two decimal places.
Sample Input0 0 0 10 1 1 0
Sample Output1.001.41
1#include <stdio.h>2#include <stdlib.h>3#include <math.h>4 intMain ()5 {6 Doublex1,y1,x2,y2,d;7 while(SCANF ("%LF%LF%LF%LF", &x1,&y1,&x2,&y2)! =EOF)//Unlimited input two point coordinates8 {9D= (sqrt) ((x1-x2) * (X1-X2) + (y1-y2) * (y1-y2)); Distance formula between two pointsTenprintf"%.2lf\n", D); reserved two decimal places One } A return 0; -}
Calculate the distance between two points, hdu-2001