帮忙看看,谢谢!!
这是一个扑克发牌的程序,不知道哪错了,没有运行结果,帮忙看看.谢谢#include<stdio.h>
#include<time.h>
typedef struct {
char *face;
char *suit;
}card;
void fp(card *,char [],char*[]);
void xp(card *);
main(){
char face[]={'A','2','3','4','5','6','7','8','9','10','J','Q','K'};
char *suit[]={"HT","HX","MA","FK"};
char *px[52];
srand(time(NULL));
fp(px,face,suit);
xp(px);
}
void fp(card *Px_1,char fa1[],char *su1[]){
int i;
for(i=0;i<=51;i++){
Px_1[i].face=fa1[i%13];
Px_1[i].suit=su1[i%4]; 到这个循环整个程序就停了..想不通啊...
}
}
void xp(card *Px_1){
int j,i,n=0,s[52]={0};
for(i=0;i<=51;i++){
j=rand()%52;
if(i==0)
s[i]=j;
for(n=0;n<i;n++){
if(j==s[n]){
i=i-1;
break;
}
}
if(n==i)
s[i]=j;
printf("%c %s\n",Px_1[j].face,Px_1[j].suit);
}
}