fork download
  1. #include <stdlib.h>
  2. #include <time.h>
  3. int main()
  4. {
  5. srand(time(0));
  6. int i,j,a[52],player[4][13];
  7. char suit[4]={'S','H','D','C'};
  8. char rank[13]={'A','2','3','4','5','6','7','8','9','T','J','Q','K'};
  9. for(i=0;i<52;i++)//創造一副新牌
  10. a[i]=i;
  11. for(i=0;i<52;i++)//隨機洗牌
  12. {
  13. j=rand()%52;
  14. temp=poker[i];
  15. poker[i]=poker[j];
  16. poker[j]=temp;
  17. }
  18. for(i=0;i<13;i++)//列印
  19. {
  20. for(j=0;j<4;j++)
  21. print(player[i][j]);
  22. printf("\n");
  23. }
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:14:1: error: 'temp' undeclared (first use in this function)
 temp=poker[i]; 
 ^
prog.c:14:1: note: each undeclared identifier is reported only once for each function it appears in
prog.c:14:6: error: 'poker' undeclared (first use in this function)
 temp=poker[i]; 
      ^
prog.c:21:1: warning: implicit declaration of function 'print' [-Wimplicit-function-declaration]
 print(player[i][j]); 
 ^
prog.c:22:1: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
 printf("\n"); 
 ^
prog.c:22:1: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:22:1: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:8:6: warning: unused variable 'rank' [-Wunused-variable]
 char rank[13]={'A','2','3','4','5','6','7','8','9','T','J','Q','K'}; 
      ^
prog.c:7:6: warning: unused variable 'suit' [-Wunused-variable]
 char suit[4]={'S','H','D','C'}; 
      ^
prog.c:6:9: warning: variable 'a' set but not used [-Wunused-but-set-variable]
 int i,j,a[52],player[4][13]; 
         ^
stdout
Standard output is empty