问答题

函数fun()的功能是:将s所指字符串中的字母转换为按字母序列排列的其后续字母(注:Z转换为A,z转换为a),其他字符不变。
改正函数fun()中指定部分的错误,使它能得出正确的结果。
#include<stdio.h>
#include<ctype.h>
void fun(char *s)

/**********found**********/
while(*s!=’@’)
if(*s>=’A’&&*s<=’Z’||*s>=’a’&&*s<=’z’)
if(*s==’Z’)*s=’A’;
else if(*s==’Z’)*s=’a’;
else *s+=1;

/**********found**********/
(*s)++;


main()
char s[80];
printf("\n Enter a string with length<80.:\n\n");gets(s);
print"\n The string:\n\n");puts(s);
fun(s);
printf("\n\n The Cords:\n\n");puts(s);

【参考答案】

(1)while(*s)或while(*s!=’\0’)或while(*s!=0); (2)s++;