c语言0分,大佬们帮忙看看

P4414 [COCI2006-2007#2] ABC

Taolaodi @ 2024-11-19 20:03:45

#include<stdio.h>
int main()
{
    int a,b,c,A,B,C;
    scanf("%d %d %d", &a, &b, &c);
    char ch;
    A = (a < b ? a : b) < c ? (a < b ? a : b) : c;
    C = (a > b ? a : b) > c ? (a > b ? a : b) : c;
    B = a + b + c - A - C;
    for (int i = 0; i < 4; i++)
    {
        scanf("%c", &ch);
        if (ch=='A')
        {
            printf("%d ", A);
        }
        if (ch == 'B')
        {
            printf("%d ", B);
        }
        if (ch == 'C')
        {
            printf("%d ", C);
        }
    }
    return 0;
}

by zhanghuanwen @ 2024-11-23 12:49:31

是不是scanf把回车读入了 @TeacherTao


by Taolaodi @ 2024-11-25 14:08:38

@zhanghuanwen解决了感谢


|