#include
void change(char s[]) {
int i;
for(i = 0; s[i]; ++i) {
if(s[i] >= 'a' && s[i] <= 'z')
s[i] = (s[i] + 2 - 'a')%26 + 'a';
else if(s[i] >= 'A' && s[i] <= 'Z')
s[i] = (s[i] + 2 - 'A')%26 + 'A';
}
}
int main() {
char s[256];
printf("输入一个字符串:");
scanf("%s",s);
change(s);
printf("转换后为:%s\n",s);
return 0;
}
取ASICII 码值就行了