bjrjk @ 2016-01-26 19:59:59
#include <iostream>
#include <string>
using namespace std;
int main(){
int a;
string str;
cin>>a;
a%=26;
cin>>str;
for(int i=0;i<str.length();i++){
str[i]=int(str[i]+a);
}
cout<<str;
return 0;
}
by 寻梦 @ 2016-06-25 09:22:38
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
char a[100];
int n,x,k;
cin>>n;
cin>>a;
x=strlen(a)-1;
for (int i=0;i<=x;i++)
{
k=a[i]+n;
if (k>122) k-=26;
a[i]=k;
}
for (int i=0;i<=x;i++)
cout<<a[i];
return 0;
}