#include <stdio.h>
#include <math.h>
double distance(float x1,float y1,float x2,float y2)
{
double d;
float sum;
sum=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
d=sqrt(sum);
return d;
}
int main()
{
double d;
double distance(float,float,float,float);
float x1,x2,y1,y2;
printf("\nplease input the coordinate of
point A:");
scanf("%4f%4f",&x1,&y1);
printf("\nplease input the coordinate of
point B:");
scanf("%4f%4f",&x2,&y2);
if (x1==x2&&y1==y2)
return 0.0;
else
d=distance(x1,y1,x2,y2);
printf("the distance beween A and B is %f",d);
}
这样就可以了,把文件名放开头