下列给定程序中,函数fun的功能是:将str所指字符串中的字母转换为按字母序列的后续字母(Z转换A,z转换a),其他字符不变。
请修改函数fun中的错误,得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
void fun(char*str)
/*******found*********/
while(*str!=’@’)
if(*str>=’A’&&*str<=’Z’||*str<=’a’&&*str<=’z’)
if(*str==’Z’)
*str=’A’;
else if(*str==’z’)
*str=’a’;
else
*str+=1;
/*******found*********/
(*str)++;
main()
char str[80];
printf("\n Enter a string with length<80.:\n\n");
gets(str);printf("\n The string:\n\n");
puts(str);
fun(str);
printf("\n\n The Cords:\n\n");
puts(str);