【说明】 编写程序,生成一个新文本文件,它由一个已知文本文件的所有偶数行组成。要求已知文本文件名和新文本文件名均从键盘输入。请填空完善程序。 【C语言程序】 #include<stdio.h> main() { FILE *oldf,*newf; char ch,fname[20]; int i; do{ printf("Enter name of existed text file to be read:"); scanf("%s",fname); if((oldf=fopen(fname,"r"))==NULL) printf("File %s can’t open!\n",fname); }while(oldf==NULL); do{ printf("Enter mane of new text file to be written:"); scanf("%s",fname); if(( (1) ==NULL) printf("File %s can’t open!\n",fname); }while( (2) ); i=1; while(!feof(oldf)) { while((ch=fgetc(oldf))!= (3) ) { if(i%2== (4) ) fputc(ch,newf); } fputc(’\n’,newf); (5) ; } fclose(oldf); fclose(newf); }