输出是燎
查看原帖
输出是燎
468071
galfth楼主2021/3/21 20:53

跪求各位神犇能帮我看看这道题,输入25和xyz输出的是燎,这是为什么?

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n%=26; 
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		s[i]+=n;
		if(s[i]>'z')
		s[i]-=26;
	}
	cout<<s;
	return 0;
}
2021/3/21 20:53
加载中...