#include<stdio.h>
#include<process.h>
void main()
{
int n;
FILE *fp,*fp1;
if((fp=fopen("data.txt","rb"))==NULL)
{
printf("can not open this file!\n");
exit(0);
}
if((fp1=fopen("data1.txt","w"))==NULL)
{
printf("can not open this file!\n");
exit(0);
}
while(fscanf(fp,"%d",&n)!=EOF)
{
fscanf(fp,"%d",&n);
if(n%2==0)
n=n-1;
else
n=n+1;
fprintf(fp1,"%5d",n);
}
fclose(fp);
fclose(fp1);
}
温馨提示:答案为网友推荐,仅供参考