moqwq @ 2022-12-21 18:16:33
#include<bits/stdc++.h>
using namespace std;
char a[10000];
int main()
{
int n;
cin>>a;
for(int i=0;i<n;i++)
{
if(a[i]!='z')
{
a[i]+=1;
}
else{
a[i]='a';
}
}
for(int i=0;i<n;i++)
{
cout<<a[i];
}
return 0;
}
by chenzhiyuan0923 @ 2022-12-21 18:19:58
@moqwq
int n;
n
的值是什么
by moqwq @ 2022-12-21 18:24:39
对哦,感谢大佬
by moqwq @ 2022-12-21 18:33:58
#include<bits/stdc++.h>
using namespace std;
char a[10000];
int main()
{
int n;
cin>>n>>a;
int s=strlen(a);
for(int i=0;i<s;i++)
{
if(a[i]+n<='z')
{
a[i]+=n;
}
else{
a[i]='a';
a[i]+=n-1;
}
}
for(int i=0;i<s;i++)
{
cout<<a[i];
}
return 0;
}
改完了,60分-_-
by lucky_loser @ 2022-12-21 19:03:34
把数组改成string试试
by Feng_Jing @ 2022-12-21 19:27:41
@moqwq 是这样,这个
我的建议是先把 z