#include<stdio.h>
#include<stdlib.h>
int main(void)
{FILE *fp1,*fp2;
int n,i;
char a[100],b[100],c[100],d[100];
printf("输入明文文件名:");
gets(a);
printf("输入n的值:");
scanf("%d",&n);
fp1=fopen(a,"w");
fprintf(fp1,"This is a C file!");
fclose(fp1);
fp1=fopen(a,"r");
fgets(c,18,fp1);
fclose(fp1);
printf("输入密文文件名:");
gets(d);
fp2=fopen(d,"w");
for(i=0;i<19;i++)
{c[i]+=3;
fputc(c[i],fp2);}
fclose(fp2);
printf("加密成功后的密文为:%s",c);
return 0;
}
一周热门 更多>