#include "stdio.h" #include "stdlib.h"
int main(int argc,char *argv[]) { FILE *fp1,*fp2,*fp3; char ch;
/* 看看参数是否对 */ /* 读原文件 */ if((fp1=fopen("1.txt","r"))==NULL) {printf("cant open %s \n","1.txt"); exit(0); }
/* 加密的程序 */
if((fp2=fopen("2.txt","w"))==NULL) { printf("cant open %s \n","2.txt"); exit(0); }
for(; (ch=fgetc(fp1))!=EOF; ) {putch(ch);ch=ch +4;fputc(ch,fp2);}
fclose(fp1); fclose(fp2);
/* 在打开文?*/
fp2=fopen("2.txt","r"); if((fp3=fopen("3.txt","w"))==NULL) { printf("cant open %s \n","3.txt"); exit(0); } for(; (ch=fgetc(fp2))!=EOF; ) { putch(ch);ch=ch -4;fputc(ch,fp3); } fclose(fp2); fclose(fp3);
}
这是一道文件加密题! 我想在屏幕上输出的结果是 比如: China,Ningbo Glmre0Rmrkfs China,Ningbo 要输出三个文件的内容还要换行!
请问还要修改哪里的代码?