Saito @ 2019-08-18 14:43:56
#include<bits/stdc++.h>
using namespace std;
int main(){
char old[55],anew[55];
int n,len,tnew[55];
scanf("%d",&n);
scanf("%s",old);
len = strlen(old);
for(int i=0;i<len;++i)
{
tnew[i] = (int)old[i]+n;
for(;;)
{
if(tnew[i]>97&&tnew[i]<=122)
{
anew[i] = (char)tnew[i];
break;
}
else tnew[i]-=26;
}
}
for(int i=0;i<len;++i)
printf("%c",anew[i]);
return 0;
}
by aminoas @ 2019-08-18 14:46:04
没问题您发什么求助 (逻辑鬼才)
by aminoas @ 2019-08-18 14:48:58
@CpY2
'a'
的ASCII
码是96, 不是98 ...
by Saito @ 2019-08-18 14:50:48
@QwQ自动机 哇哇哇我的错,谢谢谢谢
by chenxia25 @ 2019-08-18 14:55:25
不用谢
by Saito @ 2019-08-18 14:57:46
@QwQ自动机 ‘a’的ASCII码是97哦
by aminoas @ 2019-08-18 14:58:33
@CpY2 我看错了我自己的代码
by TRZ_2007 @ 2019-08-18 15:17:10
您干嘛不直接写a
呢?