Do a random licensing of C language program, for everyone to learn, think.
Without making any comments, there are some output statements left during the test, which is convenient for testing.
/*author:nunuqq:398269786*/#include <stdio.h> #include <stdlib.h> #include <time.h>int main () {int a [60];int b[60];int w = 0;int wi,wj,wii;int i,j,index,x=0,m;for (i=0;i<54;i++) A[i]=i+1;srand ((unsigned) time (0)); for (i=0;i<54;) {Index=rand ()%54;if (a[index]!=0) {b[i]=a[index];//printf ("%d", B[i]); a[index]=0;++i;}} printf ("\ n Description: \ n");p rintf ("*******************\n");p rintf ("* * Red Peach%c", 3);p rintf ("**\n");p rintf ("* * Block%c", 4) ;p rintf ("**\n");p rintf ("* * Meihua%c", 5);p rintf ("**\n");p rintf ("* * Spades%c", 6);p rintf ("**\n");p rintf ("* * king A **\n** Xiao Wang a **\n ");p rintf (" *******************\n ");p rintf (" \ n Please enter the number of cards: \ n "); scanf ("%d ", &w); wi = 54/W;WJ = 54 %w;//printf ("%d,%d", WI,WJ); for (j = 0;j < w;j++) {m = 0;printf ("\ n \ nthe first person's card \ n", j+1); WJ--;if (wj>=0) Wii = wi + 1;else Wii = wi;//Red peach printf ("Red Peach%c", 3);p rintf (":"); for (i = j*wii;i< (j+1) *wii;i++) {if (b[i]<=13&&b[i]>0) {m++ ; if (b[i]==11) printf ("J"); else if (b[i]==12) printf ("Q"); ElSe if (b[i]==13) printf ("K"); elseprintf ("%d", B[i]);}} Block printf ("\ n Block%c", 4);p rintf (":"); for (i = j*wii;i< (j+1) *wii;i++) {if (b[i]<=26&&b[i]>13) {m++;b[i ] = b[i]-13;if (b[i]==11) printf ("J"), else if (b[i]==12) printf ("Q"), else if (b[i]==13) printf ("K"); elseprintf ("%d", B[i] );}} Plum printf ("\ n Plum%c", 5);p rintf (":"); for (i = j*wii;i< (j+1) *wii;i++) {if (b[i]<=39&&b[i]>26) {m++;b[i ] = b[i]-26;if (b[i]==11) printf ("J"), else if (b[i]==12) printf ("Q"), else if (b[i]==13) printf ("K"); elseprintf ("%d", B[i] );}} Spade printf ("\ n Spades%c", 6);p rintf (":"); for (i = j*wii;i< (j+1) *wii;i++) {if (b[i]<=52&&b[i]>39) {m++;b[i ] = b[i]-39;if (b[i]==11) printf ("J"), else if (b[i]==12) printf ("Q"), else if (b[i]==13) printf ("K"); elseprintf ("%d", B[i] );}} Size King printf ("\ n size King A or A:"); for (i = j*wii;i<= (j+1) *wii;i++) {if (b[i]==53) {m++;p rintf ("a");} if (b[i]==54) {m++;p rintf ("a");}} printf ("\ n total:%d cards!!! ", m);}}
The test results, because the screen display is limited, I only do 2 people to test the card, the other self-test it,
C-Language random licensing program (hearts, Spades, clubs, squares)