I am working on a program in C++ but struggling a bit. Right now I have:
All needed #includes
enum Suit {SPADES=0, HEARTS=1, DIAMONDS=2, CLUBS=3}
typedef struct Card {
Suit suit;
int value;
} Card;
int main() {
Card deck[52];
int cardNum = 52;
int suitNum = 4;
int faceNum = 13;
for (int i = 0; i < suitNum; i++) {
for (int j = 0; j < faceNum; j++) {
deck[cardNum].suit = suitNum[i];
deck[cardNum].value = faceNum[j];
cardNum--;
}
}
Obviously, this is incorrect. I am struggling to come up with the correct initialization here, and I have been working on this for a while. Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire