Question: C++ Coded program Instructions Write a program that uses an array of structs to represent a card deck, where the card values are represented by
C++ Coded program
Instructions Write a program that uses an array of structs to represent a card deck, where the card values are represented by enumerated types for the suit and cardValue. Your program will use functions to create the card deck, print a single card, print the card deck, deal two cards, then determine which card is the winner. Requirements: 1. Use the enumerated types and data structures defined below: enum suits {CLUBS, DIAMONDS, HEARTS, SPADES}; enum cardValues {TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE}; struct cards {suits suit; cardValues card; }; cards deck[52]; cards card1, card2; 2. Define and implement the following functions: void createDeck (cards[]); void printDeck (cards[]); void printCard(cards); void deal (cards[], cards&); void winner (cards, cards); 3. Write a main program that calls the functions to: a. Create the deck b. Print the deck c. Randomly deal card 1 (Hint: use the random function (see page 128) to randomly generate a number between 0 and 51 that represents the array location of the card). d. Print card 1 e. Randomly deal card 2 f. Print card 2 g. Print the winning card 4. Output must be labelled and easy to read
Higher card wins. Suit in order wins: Hearts, diamonds, spades, clubs
Sample output

Pick a card The card deck Two of Clubs Three of Clubs Four of Clubs Five of Clubs Six of Clubs Seven of Clubs Eight of Clubs Nine of Clubs Ten of Clubs Jack of Clubs Queen of Clubs King of Clube Ace of Clubs Two of Dianonds Three of Dianonds Four of Dianonds Five of Dianonds Six of Dianonds Seven of Dianonds Eight of Dianonds Nine of Dianonds Ten of Dianonds Jack of Dianonds Queen of Dianonds King of Dianonds Ace of Diamonds Two of Hearts Three of Hearts Four of Hearts Five of Hearts Six of Hearts Seven of Hearts Eight of Hearts Nine of Hearts Ten of Hearts Jack of Hearts Queen of Hearts King of Hearts Ace of Hearts Two of Spades Three of Spades Four of Spades Five of Spades Six of Spades Seven of Spades Eight of Spades Nine of Spades Ten of Spades Jack of Spades Queen of Spades King of Spades Ace of Spades cardi - Four of Hearts card2 = Ace of Spades And the winner is .... card 2 wins Ace of Spades Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
