萌新在vs上运行正常,但洛谷上编译失败,求大佬教教
查看原帖
萌新在vs上运行正常,但洛谷上编译失败,求大佬教教
148125
Falcone楼主2023/9/6 16:46

这里是代码

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int n,l=0;
	cin >> n;
	string str1;
	cin >> str1;
	l = size(str1);
	for (int i = 0; i<=l-1;i++)
	{
		str1[i] += n;
		if (str1[i] > 'z')
		{
			int t = (int)str1[i]-122;
			str1[i] = (t % 26) + 'a'-1;
		}
	}
	cout << str1;
	return 0;
}
2023/9/6 16:46
加载中...