在输入时只能输第一个n,后面的字符串都输不进去就会直接出结果,输出什么都没有。。。
#include<iostream>
using namespace std;
char ch[55];
int main()
{
int len=1,n,i;
scanf("%d",&n);
while((ch[len]=getchar())!='\n') len++;
len--;
for(i=1;i<=len;i++)
{
ch[i]=ch[i]+n;
if(ch[i]>'z')
cout<<ch[i]-26;
else cout<<ch[i];
}
return 0;
}
谢谢帮助!!!