填空题
下列给定程序中,函数proc()的功能是:将str所指字符串中的字母转换为按字母序列的后续字母(但Z转化为A,Z转化为a),其他字符不变。
请修改函数proc()中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
void proc(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)++;
}
}
void main()
{
char str[80];
system("CLS");
printf("/n Enter a string with length
<80:/n/n");gets(str);
printf("/n The string:/n/n");puts(str);
proc(str);
printf("/n;n The Cords:/n/n");puts(str);
}