C语言编写,也不知道为什么全错

P1914 小书童——凯撒密码

花Q渔夫 @ 2022-11-04 21:17:45


#include<stdio.h>
#include<string.h>
int main(){
    int n;
    char a[51]={};
    scanf("%d",&n);
    getchar();
    gets(a);

    for(int i=0;i<strlen(a);i++){
        a[i]+=n;
        if(a[i]>'z'){
            a[i]-=26;
        }
        printf("%c",a[i]);
    }
    return 0;
} 

by SaintRelief @ 2022-11-04 21:22:58

gets被禁了


by SaintRelief @ 2022-11-04 21:23:33

用cin


by a2lyaXNhbWUgbWFyaXNh @ 2022-11-04 21:31:21

@LDH123 c语言哪有cin/cf


by SaintRelief @ 2022-11-04 21:35:24

我以为是c++


by SaintRelief @ 2022-11-04 21:35:55

scanf也行


|