#include
Void Output (int CARD [], int N) / * conversion output function, convert the generated random number into a playing card output * / {INT I, J;
Textbackground (1); for (i = 0; i Case 11: Printf ("% CJ", 5); Break; Case 12: Printf ("% CQ", 5); Break; Case 13: Printf ("% CK", 5); Break; Case 14: Printf "% ca", 5); break;} case 3: Switch (CARD [i] -78 4) / 2) {Case 2: Case 3: Case 4: Case 5: Case 6: Case 7: Case 8 : Case 9: Case 10: Printf ("% C% D", 6, (CARD [I] -78 4) / 2); Break; Case 11: Printf ("% CJ", 6); BREAK; CASE 12: Printf ("% CQ", 6); Break; Case 13: Printf ("% CK", 6); Break; Case 14: Printf ("% CA", 6); Break;} case 4: IF Card [i] == 104 || Card [i] == 105) Printf ("joker"); if (Card [i] == 106 || Card [i] == 107) Printf ("joker"); Break; default: Break;}} } main () {Int i, j, flag, n; / * Remain array is used to play the base card * / int Remain [9], Cards1 [26], Cards2 [26], Cards3 [26], Cards4 [26]; / * Cards array is used to put the card, and the array of 25 per person is 26 is for convenient sorting * / int regard why [100]; / * Whole array is used to release the card, easy to remember * / SRAND (NULL); for (i = 0; i <25; i ) {cards1 [i] = rand ()% 108; FLAG = I; for (j = 0; j
For (i = 0; i <25; i ) {cards4 [i] = rand ()% 108; FLAG = i; for (n = 0; n <25; n ) {if (! (! (! (cards1 [n] - Cards4 [i]) ||! (cards2 [n] -cards4 [i]) ||! (cards3 [n] -Cards4 [i])) {i-; break;}} f (i! = flag) Continue; for (j = 0; j
INSERTSORT (CARDS1, 26); Insertsort (Cards2, 26); Insertsort (CARDS3, 26); Insertsort (Cards4, 26); Insertsort (Remain, 9); Printf ("/ NCards of Four Players Are: / n / n" ); Printf ("East Player: / N"); OUTPUT (CARDS1, 26); Printf ("/ n"); Printf ("South Player: / N"); OUTPUT (CARDS2, 26); Printf ("/ N "); Printf (" West Player: / N "); OUTPUT (CARDS3, 26); Printf (" / N "); Printf (" North Player: / N "); Output (Cards4, 26); Printf "/ n / N"); Printf ("The Left Cards Are: / N / N); Printf (" "); OUTPUT (Remain, 9); Printf (" / n "); getCh ();}