有没有大佬看看我这题哪错了,包回关的
查看原帖
有没有大佬看看我这题哪错了,包回关的
1482388
sweet_520楼主2024/10/25 22:02
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] + n > 'z')
		{
			char temp = s[i];
			s[i] = 'a';

			s[i] += n - ('z' - temp);
		}
		else
		s[i] += n;//s本身已经为string,无需强制转换
		
	}
	cout << s << endl;
}
2024/10/25 22:02
加载中...