Question: #ifndef STRUCT_CARD_H_INCLUDED #define STRUCT_CARD_H_INCLUDED // SRM // 4/4/17 // Define our card struct and all other needed info // define our suit enum, DIAMOND is
#ifndef STRUCT_CARD_H_INCLUDED #define STRUCT_CARD_H_INCLUDED // SRM // 4/4/17 // Define our card struct and all other needed info // define our suit enum, DIAMOND is 0, SPADE is 3 enum Suit { DIAMOND, CLUB, HEART, SPADE }; // define our rank enum, TWO is worth 2, ACE is worth 14 enum Rank { TWO = 2, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }; // define our card structure struct Card { Suit card_suit; // this will store the suit of our card Rank card_rank; // this will store the value of our card }; // define a function that pretty-prints our card void printCard( Card A ); // both will work, num is how many cards to print //void printDeck( Card *deck, int num ); void printDeck( Card deck[], int num ); #endif // STRUCT_CARD_H_INCLUDED #include#include "struct_card.h" // include our library using namespace std; int main() { Card myCard; // create a new thing, of type Card, named myCard // make it an Ace of Spades: myCard.card_rank = ACE; myCard.card_suit = SPADE; // print out the card cout << myCard.card_rank << myCard.card_suit; printCard( myCard ); // create an array of 52 cards, name it deck Card deck[ 52 ]; // make the first card Ace of Spades deck[ 0 ].card_rank = ACE; deck[ 0 ].card_suit = SPADE; // make the second card King of Clubs deck[ 1 ].card_rank = KING; deck[ 1 ].card_suit = CLUB; // make last card five of diamonds deck[ 51 ].card_rank = FIVE; deck[ 51 ].card_suit = DIAMOND; return 0; }
i need to make in C++
complete the code from class (printDeck) and also complete part h of the previous exam: create a function that fills deck with all of the cards of a full deck (we wont have jokers). The deck should be in order (eg, two to Ace of Spades, two to Ace of Hearts, two to Ace of Clubs, and two to Ace of Diamonds). in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
