Latest web development tutorials

C Exercise Example 22

100 cases of classic C language 100 cases of classic C language

Title: Two table tennis team to compete, each of the three. A team of a, b, c three, B team for the x, y, z three. I have decided to contest ballot list. Asking someone to the list of game players. He does not say a ratio x, c said he did not and x, z ratio, programmed to identify a list of three teams racer.

Source Code:

//  Created by www.w3big.com on 15/11/9.
//  Copyright © 2015年 本教程. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char i,j,k;
    for(i='x';i<='z';i++) {
        for(j='x';j<='z';j++) {
            if(i!=j) {
                for(k='x';k<='z';k++) {
                    if(i!=k&&j!=k) {
                        if(i!='x'&&k!='x'&&k!='z') {
                            printf("顺序为:a--%c\tb--%c\tc--%c\n",i,j,k);
                        }
                    }
                }
            }
        }
    }
}

The above example output is:

顺序为:a--z	b--x	c--y

100 cases of classic C language 100 cases of classic C language