爆0了,用的EOF

P1914 小书童——凯撒密码

fly__sheep @ 2024-05-30 21:57:41

#include<cstring>
#include<cstdio>
using namespace std;
int main(){
    int n;
    char x;
    scanf("%d",&n);
    while(1){
        if(x==EOF){
            break;
        }
        x=getchar();
        if(x+n>'z'){
            putchar((x+n)%'z'+'a'-1);
        }
        else{
            putchar(x+n);
        }
    }
    return 0;
}

by pi3_141592653589 @ 2024-06-24 20:44:20

建议使用string


|