/*----------------------------------------------------------------------
【程序设计】
------------------------------------------------------------------------
函数 fun 的功能是: 将 输入的字符串中的字母转换为按字母序列的后续字母(但
Z 转换为 A, z 转换为 a),其它字符不变,最后输出转换后的字符串。
示例1:
【请输入一个字符串: 】12345QAZWSXrfvtgb!!@!@@¥
【转换后的字符串为: 】12345RBAXTYsgwuhc!!@!@@¥
------------------------------------------------------------------------
----------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void fun(char *str)
{
    /**********Program**********/
	char *p;
	p=str;
	while(*p != '\0'){
		if(*p>='a'&&*p<='z'){
			*p=((*p+1)<'z'?(*p+1):'a');
		}
		if(*p>='A'&&*p<='Z'){
			*p=((*p+1)<'Z'?(*p+1):'A');
		}
		p++;
	}
    /********** End **********/
}
int main()
{
    char input[100];
    printf("【请输入一个字符串: 】");
    fgets(input, sizeof(input), stdin);
    input[strcspn(input, "\n")] = '\0';
    fun(input);
    printf("【转换后的字符串为: 】%s\n", input);
    return 0;
}