#include
#include
#include
typedef struct
{
char *value;
char *suit;
}card;
void fillDeck(card *Deck, char *Value[], char *Suit[])
{
int i;
for(i=0;i<52;i++)
{
Deck[i].value=Value[i%13];
Deck[i].suit=Suit[i/13];
}
}
void shuffle(card *Card)
{
int i, j;
card temp;
for(i=0;i<52;i++)
{
j=rand()%52;
temp=Card[i];
Card[i]=Card[j];
Card[j]=temp;
}
}
void display(card *Card)
{
int i;
for(i=0;i<52;i++)
printf("%s-%s\t", Card[i].value, Card[i].suit);
}
int main()
{
card deck[52];
char *value[]={"A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"};
char *suit[]={"C", "S", "H", "D"); /*error occurs at this line*/
srand(time(NULL));
fillDeck(deck,value,suit); /*another error occurs at this line*/
shuffle(deck);
display(deck);
}
what's the problem?
2007-03-10
00:33:47
·
3 answers
·
asked by
forgetfulpcspice
3
in
Computers & Internet
➔ Programming & Design