(1)
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
void main()
{
char a;
char b[]="";
int i=0;
int k=0;
a=getche();
cin>>b;
FILE *file;
file=fopen("d:\\zml.txt","w");
if(file==NULL) exit(1);
cout<<"请做好准备,开始录入文件:"<<endl;
while(1)
{
for(k=0;b[k]!='/0';k++)
{
a=getche();
if (int(a)==13)
{
cout<<endl;
fprintf(file,"%c",char(10));
}
if (int(a)==13) continue;
if(int(a)==8)
{
cout<<endl;
exit(0);
}
fprintf(file,"%d",int(a)+int(b));
}
}
}
(2)
#include<iostream.h>
#include<stdio.h>
#include<process.h>
void main()
{
int a;
char b[]="";
int k=0;
cin>>b;
FILE *file;
file=fopen("d:\\zml.txt","r");
if(file==NULL) exit(1);
cout<<"请做好准备,开始输出文件:"<<endl;
while(1)
{
for(k=0;b[k]!='/0';k++)
{
if(feof(file)) exit(0);
fscanf(file,"%d",a);
cout<<char(a-int(b[k]))<<flush;
}
}
}
各高手帮 I 看看了,为啥第一个可以用,而第二个不可以用呢???