下列程序将文本文件data1.txt中存储的数字0~8(包含0和8)加密后保存到...
发布网友
发布时间:2024-02-03 21:32
我来回答
共2个回答
热心网友
时间:2024-08-30 20:51
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp1,*fp2 ;
char c1,c2;
fp1=fopen("houpp","r");
fp2=fopen("hou","w");
while((c1=fgetc(fp1))!=EOF)
{
if (c1>='0'&&c1<='8')
{
c2=c1+1;
fputc(c2,fp2);
}
}
fclose(fp1);
fclose(fp2);
}
热心网友
时间:2024-08-30 20:53
7. fopen("data1.txt","r")
8. fopen("data2.txr","w")
9.!(eof == (c1 = fgetc(fp1)))
10. putc((int)c2,fp2)