char ch[10];
rewind(stdin);
printf("请输入英文句子:\n");
scanf("%s",ch);
int len = strlen(ch);
for (int i = 0;i < len;i++)
{
if ((ch[i] >= 'a' && ch[i] <= 'w') || (ch[i] >= 'A' && ch[i] <= 'W'))
{
for (int j = 1;j <= 3;j++)
{
printf("%c",ch[i]+j);
}
}else if ((ch[i] >= 'x' && ch[i] <='z') || (ch[i] >= 'X' && ch[i] <= 'Z'))
{
for (int j = 1; j<= 3;j++)
{
printf("%c",ch[i]+j-26);
}
}else
{
printf("%c",ch[i]);
}
}
新鲜出炉的代码 纯手打 |