计算两点间的距离(hdu2001)-LMLPHP

注意:在C语言中,double->lf,结果保留两位小数->0.2lf

#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
double x1,y1,x2,y2;
char d;
while(scanf("%lf%lf%lf%lf%c",&x1,&y1,&x2,&y2,&d)!=EOF)
{
double a;
a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
printf("%.2lf\n",a);
}
}
05-27 05:11