fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. void shuffle(int[][13]);
  6. void print_trump(int[][13],int*,int*);
  7. int m=0,r=0,r2=0;
  8.  
  9. int main(void) {
  10.  
  11. int deck[4][13]={0};
  12. int trump_mark[4]={100,200,300,400};
  13. int trump_num[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
  14. srand(time(NULL));
  15. for(int i=0; i<4; i++){
  16. for(int j=0; j<13; j++){
  17. m++;
  18. shuffle(deck);
  19. print_trump(deck,trump_mark,trump_num);
  20. }
  21. }
  22.  
  23. return 0;
  24. }
  25.  
  26. void shuffle(int deck[][13]){
  27.  
  28. r=rand()%4+1;
  29. r2=rand()%13+1;
  30.  
  31. }
  32.  
  33. void print_trump(int deck[][13], int* trump_mark, int* trump_num){
  34. printf("%d: %d-%d\n",m,r*100,r2);
  35. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
1: 400-10
2: 200-4
3: 100-10
4: 400-3
5: 200-9
6: 300-5
7: 100-2
8: 100-11
9: 300-5
10: 200-11
11: 100-1
12: 400-2
13: 100-3
14: 300-7
15: 200-9
16: 100-9
17: 200-13
18: 400-13
19: 200-7
20: 300-9
21: 200-11
22: 300-11
23: 200-8
24: 100-7
25: 200-7
26: 400-13
27: 100-8
28: 300-5
29: 400-9
30: 400-8
31: 300-3
32: 100-13
33: 300-3
34: 200-1
35: 200-4
36: 300-10
37: 400-11
38: 400-13
39: 400-7
40: 100-8
41: 200-12
42: 300-9
43: 300-10
44: 300-4
45: 200-13
46: 200-12
47: 200-4
48: 300-9
49: 100-12
50: 400-1
51: 300-8
52: 400-5