I'm trying to make a deck of cards to use in a blackjack game but I'm having problems.
#include <stdio.h>
#include <math.h>
#include <string.h>
main(){
int i;
typedef struct {
int rank, suit;
} cardtype;
cardtype deck[52];
cardtype hand[5];
char *rank[13] = {"ace", "Duece", "3", "4", "5", "6", "7", "8", "10", "Jack", "Queen", "King"};
char *suit[4] = {"Clubs", "Diamonds", "Hearts", "Spades"};
for(i=1; i < 52; i++){ //this is the part that i'm having trouble with
rank[deck[i].rank] = rank[i%13-1]; //I didn't really know how to do it so i just
suit[deck[i].suit] = suit[i/13];} //experimented, probably gibberish lol
//for(i=0; i < 52 ; i++)
//{print("%s of %s", rank[deck[i].rank], suit[deck[i].rank]);};
return 0;
}
any help would be much appreciated thanks!!