# include <stdio.h>
int main()
{
int trans(char);
char c;
printf("输入一串字符串进行翻译:\n");
c = getchar();
while(c != '\n')
{
c = trans(c);
printf("%d", c);
getchar();
}
putchar('\n');
return 0;
}
trans(char ch)
{
if(ch >= 65 && ch <= 86 || ch >= 97 && ch <= 118) ch += 4;
if(ch >= 87 && ch <= 90 || ch >= 119 && ch <= 122) ch -= 22;
return ch;
}
就是我只输入了4个字符,结果却输出了5个,这是怎么回事啊??
菜鸟正在学习,跪求大神解答!