wzb123 @ 2017-08-01 15:35:26
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
int n;
cin>>n;
cin>>s;
for(int i=0;i<=s.size();i++){
s[i]=s[i]+n;
}
cout<<s;
return 0;
}
by wzb123 @ 2017-08-01 15:36:03
各位帮帮忙
by Nj85 @ 2017-08-01 15:48:56
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
string s;
int n,i,j;
cin>>n;
cin>>s;
for(i=0;i<s.size();++i) //字符串从0到size-1,所以不能加'=';
{
for(j=1;j<=n;++j)
{
++s[i];
if(s[i]>'z') //考虑跃出的情况
s[i]='a';
}
}
cout<<s;
return 0;
}
by wzb123 @ 2017-08-02 08:14:54
感谢你,已经对了,谢谢!!!