C语言-比赛问题

    科技2022-07-12  142

    两个乒乓球队进行比赛,各出三人。甲队为 a , b , c a,b,c a,b,c 三人,乙队为 x , y , z x,y,z x,y,z 三人。已抽签决定比赛名单。有人向队员打听比赛的名单。 a a a 说他不和 x x x 比, c c c 说他不和 x , z x,z x,z 比,请编程序找出三队赛手的名单。

    **输出格式要求:“order is a–%c\tb–%c\tc–%c\n” 程序运行示例如下: order is a–z b–x c–y

    # include <stdio.h> int main(void){ char a,b,c,str; for (str='x';str<='z';str++){ if (str != 'x' && str != 'z'){ / c不和x,y比 / c = str; } } for (str='x';str<='z';str++){ if (str != 'x' && str != c){ / a不和x比,且a不和c同一对手 / a = str; } } for (str='x';str<='z';str++){ if (str != a && str != c){ / b不和a,c同一对手 / b = str; } } printf("order is a--%c\tb--%c\tc--%c\n",a,b,c); return 0; }
    Processed: 0.013, SQL: 8