爆零求助。。。
查看原帖
爆零求助。。。
370032
1998ikun0802楼主2022/7/31 18:20

在输入时只能输第一个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;
}

谢谢帮助!!!

2022/7/31 18:20
加载中...