Playing Cards int card[___], num[___]; n=rand()%____; Playing Cards 列印出來 card[0] 7 card[1] 11 card[2] 51 card[3] 33 card[4] 22 card[5] card[6] card[7] card[8] … card[51] num[0] 1 num[1] num[2] num[3] num[4] num[5] num[6] num[7] num[8] … num[51] int card[___], num[___]; for(i=__;i<___;i++) num[__]=___; for(i=__;i<___;i++){ do{ n=rand()%___; }while(num[__]______); card[__] = ___; num[__] = ___; } for(i=0;i<52;i++){ n=rand()%52; card[i] = n; } n=7; num[7]<1 num[7] =0;
花 點數 for(i=__;i<___;i++) card[__]=___; card[i]____ card[i]____ 1 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 card[i]____ 1 2 3 花 card[i]____ 1 2 3 4 5 6 7 8 9 10 11 12 點數
char suit[4] = {"葵扇","紅心","梅花","階磚"}; char alpha[13]= "A234567890JQK"; 第1張: 28 (梅花3) 點數: 3 第2張: 25 (紅心K) 點數:10 第3張: 50 (階磚Q) 點數:10 for(i=0;i<52;i++){ printf("%2i \n", card[i]); } n = card[__]____; // 花 0-3 printf("%2i \n", n); printf("%2i \n", suit___); // "葵扇","紅心","梅花","階磚" printf("點數:%2i \n", card[i]______); // 1-13