《C语言程序设计》(第3版_乌云高娃)-11章 习题解答 第10章习题参考答案.docVIP

  • 4
  • 0
  • 约2.58千字
  • 约 3页
  • 2021-09-11 发布于湖北
  • 举报

《C语言程序设计》(第3版_乌云高娃)-11章 习题解答 第10章习题参考答案.doc

习 题 十 参 考 答 案 (1)编一程序将两个文本文件的内容合并后存入另一文件中。 #include stdio.h void main() { FILE *fp1,*fp2,*fp; char ch; fp1=fopen(myInfo.txt,r); if(fp1==NULL){ printf(cannot open this file\n); getch(); exit(0); } fp2=fopen(myInfo1.txt,r); if(fp2==NULL){ printf(cannot open this file\n); getch(); exit(0); } fp=fopen(newfile.txt,w); if(fp==NULL){ printf(cannot open this file\n); getch(); exit(0); } ch=fgetc(fp1); while(!feof(fp1)){ fputc(ch,fp); printf(%c,ch); ch=fgetc(fp1); } ch=

文档评论(0)

1亿VIP精品文档

相关文档