#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
FILE *fin, *fout;
int a,b,c,d,s;
fin=fopen("f1.txt","r"); //原始数据文件
fout=fopen("f2.txt","w"); //保存结果文件
fscanf(fin,"%d%d%d%d",&a,&b,&c,&d);
while(!feof(fin)){
s=(int)sqrt((a-b)*(a-b)+(c-d)*(c-d));
fprintf(fout,"%d\n",s);
fscanf(fin,"%d%d%d%d",&a,&b,&c,&d);
}
fclose(fin);
fclose(fout);
}
温馨提示:答案为网友推荐,仅供参考