各位大神,菜鸟有难,希望帮忙啊
#include <stdio.h>#include <math.h>
float JSValue(float a[],float b[],int size)/*compute distence between 2 pionts*/
{
float s=0.0;
int i,j;
for(i=0;i<4;i++)
{
for(j=1;j<4;j++)
s=sqrt((a[i+j]-a[i])*(a[i+j]-a[i])+(b[i+j]-b[i])*(b[i+j]-b[i]));
}
return s;
}
void main()
{float s,x[5]={-1.5,2.1,6.3,3.2,-0.7};
float y[5]={7,5.1,3.2,4.5,7.6}; int i,j;
s=JSValue(x,y,5);
printf("The sum of the distance between above 5 points is %f\n",s);
}
哪位高手帮我查查对不?求5个点两两之间的距离和