2hou2 @ 2015-07-29 10:31:09
#include <iostream>
using namespace std;
int main()
{
char t[300];
int s,i=0;
cin>>s>>t;
while(t[i]!='\0')
{
t[i]=(t[i]-96+s)%26+96;
i++;
}
cout<<t;
return 0;
}
by 2hou2 @ 2015-07-30 10:36:15
求大神帮忙看看啊
by Colythme @ 2015-08-01 13:57:42
你有判断10与X的情况吗?
by zclzslz @ 2016-05-03 20:31:52
@No_Choser
10 与 x?
请问是n==10而且字符串是‘x'吗?
你能帮我看看为什么不对吗?
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n,t;
char s[205];
int main()
{
scanf("%d",&n);
scanf("%s",s);
for(int i=0;i<=strlen(s)-1;i++)
{
if(char(int(s[i])+n)<='z')
{
printf("%c",char(int(s[i])+n));
}
else
if(char(int(s[i])+n)>'z')
{
t=n;
if(t>26)
{
while(t>26)
{
t=t-26;
}
}
printf("%c",char('a'+t-1-'z'+s[i]));
}
}
printf("\n");
return 0;
}