C语言编写一个程序,急用!!高分悬赏(正确答案追加分数)

如题所述

#include <stdio.h>

int main() {
int year,id;
double a,b,c,d;
FILE *infp,*outfp;
char infilename[] = "tmp.dat";
char outfilename[] = "tmp2.dat";
infp = fopen(infilename,"rt");
outfp = fopen(outfilename,"wt");
if(infp == NULL || outfp == NULL) {
printf("无法打开数据文件。\n");
return 1;
}
while(fscanf(infp,"%d%d%lf%lf%lf%lf",&year,&id,&a,&b,&c,&d) == 6)
if(id == 1) fprintf(outfp,"%lf %lf %lf %lf\n",a,b,c,d);
fclose(infp);
fclose(outfp);
return 0;
}

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网