Problem 3.2 tennis game teams, team A A, B, C3 person team B X, Y, Z3 people. List of game has been determined by lot. A said he did not and X ratio, C said he did not and X, Z ratio, please find the list of programming three pairs of racing.

 1 #include<stdio.h>
 2 int main(void)
 3 {
 4     char a,b,c;
 5     for(char i='X';i<='Z';++i)
 6     {
 7         a=i;
 8         for(char j='X';j<='Z';++j)
 9         {
10             if(i==j)
11                 continue;
12             b=j;
13             for(char k='X';k<='Z';++k)
14             {
15                 if(i==k || j==k)
16                     continue;
17                 c=k;
18                 if(a!='X' && c!='X' && c!='Z')
19                     printf("%c,%c,c和%c比赛\n",a,b,c);
20             }
21         }
22     }
23     return 0;
24 }

 

Guess you like

Origin www.cnblogs.com/baizhige/p/12634541.html