题目如下:
#include <stdio.h>
#include<string.h>
char change(char n)
{
if ('a' <= n && n <= 'v')
n = n + 4;
else if ('A' <= n && n <= 'V')
n = n + 4;
else if ('w' <= n && n <= 'z' || 'W' <= n && n <= 'Z')
{
switch (n)
{
case 'w':n = 'a'; break;
case 'x':n = 'b'; break;
case 'y':n = 'c'; break;
case 'z':n = 'd'; break;
case 'W':n = 'A'; break;
case 'X':n = 'B'; break;
case 'Y':n = 'C'; break;
case 'Z':n = 'D'; break;
}
}
else
n = '*';
return n;
}
int main()
{
char str[1000];
scanf("%s", str);
for (int i = 0; i < strlen(str); i++)
{
str[i] = change(str[i]);
}
for (int i = 0; i < strlen(str); i++)
printf("%c", str[i]);
return 0;
}
——不知道还有没有更好的处理方法来处理后四位字符,这里用了switch语句;今晚搜一波资源,到时评论区见!