3,4 WA了,大佬帮忙看一下

P1914 小书童——凯撒密码

czh1 @ 2023-11-16 22:39:16

#include<stdio.h>
#include<string.h>
int main(){
    int n;
    char c[50];
    scanf("%d",&n);
    scanf("%s",c);
    int len=strlen(c);
    for(int i=0;i<len;i++){
        c[i]+=n;
        if(c[i]>'z'){
            c[i]%=26;
        }
        printf("%c",c[i]);
    }
    return 0;
}

by riki1230 @ 2023-11-22 21:17:33

好好看看ascall码表吧


by riki1230 @ 2023-11-22 21:24:46

for(i=0;i<c.size();i++){
    for(j=1;j<=n;j++){
        c[i]++;
        if(c[i]>'z'){
        c[i]='a';
        }
    }
}

|