下列程序的功能是:把s字符串中的所有字母改成该字母的下一个字母,字母Z改成字母a。要求大写字母仍为大写字母,小写字母仍为小写字母,其他字符不做改变。请编写函数chg(char*s)实现程序要求,最后调用函数readwriteDAT()读取in60.dat中的字符串,并把结果输出到文件out60.dat中。
例如:s字符串中原有的内容为Mn 123Zxy,则调用该函数后,结果为No 123Ayz。
注意:部分源程序已给出。
请勿改动主函数main()和输入输出函数readwriteDAT()的内容。
[试题程序]
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define N 81
void readwriteDAT();
void chg(char*s)
voidmain()
char a[N];
system("CLS");
printf("Enter a string:");
gets(a);
printf("The original string is:");
puts(a);
chg(a);
printf("The string after modified:");
puts(a);
readwriteDAT();
void readwriteDAT()
int i;
char a[N];
FILE*f,*wf;
rf=fopen("in60.dat","r");
wf=fopen("out60.dat","w");
for(i=0;i<10;i++)
fgets(a,81,rf);
chg(a);
fprintf(wf,"%s",a);
fclose(rf);
fclose(wf);