loushanjing @ 2022-05-18 08:46:39
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string a;
cin>>a;
for(int i=0;i<a.size();i++){
a[i]+=n;
if(a[i]>='z'){
a[i]-=26;
if(a[i]>='z'||a[i]>='Z') {
for(int i=1;a[i]>='a'&&a[i]<='z';i--){
a[i]-=26;
}
}
}
}
cout<<a;
return 0;
}
哪里错了呀???
by ande @ 2022-05-18 11:24:55
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
int t,n;
char a[5000];
scanf("%d",&t);
scanf("%s",a);
n=strlen(a);
for(int i=0;i<=n-1;i++)
for(int j=1;j<=t;j++){
a[i]++;
if(a[i]>'z'){
a[i]='a';}}
/*for(int i=0;i<=n-1;i++)
{ printf("%c",a[i]);
}*/
printf("%s",a);
system("pause");
return 0;
}
by ande @ 2022-05-18 11:25:13
你错的还挺明显的