等级考试上机题目(上课用)(9)
时间:2026-01-17
时间:2026-01-17
rf = fopen("in.dat", "r");
wf = fopen("out.dat","w");
for(i = 0 ; i < 10 ; i++) {
fscanf(rf, "%d,%d", &a, &b);
fun(a, b, &c);
fprintf(wf, "a=%d,b=%d,c=%ld\n", a, b, c);
}
fclose(rf);
fclose(wf);
}
第4套
1.程序填空题
#include <stdio.h>
#include <stdlib.h>
int fun(char *source, char *target)
{FILE *fs,*ft; char ch;
/**********found**********/
if((fs=fopen(source, ___1___))==NULL)
return 0;
if((ft=fopen(target, "w"))==NULL)
return 0;
printf("\nThe data in file :\n");
ch=fgetc(fs);
/**********found**********/
while(!feof(___2___))
{putchar(ch);
/**********found**********/
fputc(ch,___3___);
ch=fgetc(fs);
}
fclose(fs); fclose(ft);
printf("\n\n");
return 1;
}
main()
9
下一篇:LED电子屏招标公告