zhagghfhgf @ 2024-10-30 17:21:23
#include <stdbool.h>
#include <math.h>
#include <ctype.h>
int main() {
int n,i = 0;
char b[50],c[50];
scanf("%d",&n);
scanf("%s",&b);
while(b[i] != '\0'){
if(b[i] + n>='a'&&b[i] + n<='z'){
c[i] = (b[i] + n);
}
else{
c[i] = b[i] + 26 -n;
}
i++;
}
printf("%s",c);
return 0;
}
by chenxitao @ 2024-10-30 17:29:39
#include<bits/stdc++.h>
using namespace std;
string s;int n;
int main(){
cin>>n;
cin>>s;
for(int i=0;i<s.size();i++){
for(int j=1;j<=n;j++){
s[i]++;
if(s[i]>'z') s[i]='a';
}
cout<<s[i];
}
return 0;
}
求关