stuck on card game in C. any suggestions?
I'm not asking for the answer, I'm just asking to be pointed in the right direction!
I'm not going to post all the code because i just need help in one section of it:
Code:
void filldeck(card deck[52])
{
/*fill the deck here*/
return;
}
The deck needs to be saved in hex format into the array, i understand that hex value format is 0x[hex number]
the way the card will be saved is:
01000011
first 2 bits (11) will be the suit (11 = heart, 01 = spade, 10 = club, 00 = diamond)
next 4 bits (0000) will be the card number
next 1 bit (1) wil be the colour (1 = red, 0 = black)
last 1 bit (0) is blank
im aware i need the 01000011 converted to hex to be saved into the array.
based on this i need to generate a deck of 52 cards, i can write the cards hex values out on a paper (by hand), but how would i go about making the code generate it into the array?
if someone can please guide me to the right resource maybe i'd really appreicate it, ive looked everywhere can't find anything that will help :(
edit: I also think i should get rid of the ++ in my username :P