Mrgteo79c @ 2022-11-24 19:07:40
#include<stdio.h>
#include<string.h>
int main()
{
int i,n;
char s[100];
scanf("%d",&n);
scanf("%s",s);
for(i=0;i<strlen(s);i++)
{
s[i]+=n;
if(s[i]>'z')
{
s[i]-=26;
}
printf("%c",s[i]);
}
return 0;
}
by AdventureExtremeX @ 2022-11-24 19:12:52
@Mrgteo79c
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
int i,n;
char s[100];
scanf("%d",&n);
scanf("%s",&s);
for(i=0;i<strlen(s);i++)
{
n=n%26;
处理循环
s[i]+=n-26;
if(s[i]<'a')s[i]+=26;
避免上溢出
while(s[i]>'z')
{
s[i]-=26;
}
循环处理
printf("%c",s[i]);
}
return 0;
}