自考“高级语言程序设计”习题答案详解(52)
8.3 程序分析题
1.读程序,写功能。
# include
# include
main()
{ FILE *f1,* f2;
int k;
if(( f1= fopen(“c:\\tc \\ pl.c”,“r” )== NULL)
{ printf(“Can not open file! \n”);
exit(0);
}
if((f2= fopen(“a:\\ pl.c”,“w” ))== NULL)
{ printf(“Can not open file! \n” );
exit(0) ;
}
for( k=1;k<=l000;k++)
{ if( feof(f1)) break;
fputc( fgetc(f1),