佬们能不能帮我看一下哪里出问题了

P1914 小书童——凯撒密码

runwei @ 2023-10-18 09:13:17

int main()
{
    char origin[51];
    int n, len;
    scanf("%d", &n);
    getchar();

    fgets(origin, 50,stdin);
    len=(int)strlen(origin);

    for (int i = 0; i <len-1; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (origin[i] == 'z')
            {
                origin[i] = 'a';
            }
            else
            {
                origin[i] = origin[i] + 1;
            }
        }
    }
    puts(origin);

}

|