#include<stdio.h>
#include<time.h>
#include<stdlib.h>
struct card{
char suit;
char face;
};
typedef struct card Card;
int main(){
int i,j;
Card puke[],t;
char face[]={'A','2','3','4','5','6','7','8','9','x','J','Q','K'};
char suit={3,4,5,6};
/*顺序存放扑克牌*/
for(i=0;i<=51;i++){
puke[i].suit=suit[i/13];// i/0...12=0,i/13...26=1
puke[i].face=suit[i%13];//i%0...12=0..12,i%13...25=0...12
}
rand(time(null));//以时间为参数生成随机数的函数;
for(i=0;i<52;i++){//随机发牌;也是洗牌,发52次每次随机一张排与顺序存储时的牌交换实现洗牌
j=rand()%52;
t=puke[i];puke[i]=puke[j];puke[j]=t;
}
for(i=0;i<52;i++)//输出洗牌后的结果
printf("%c%c\t",puke[i].suit,puke[i].face);
}