Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 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); 1. 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 Create the deck a. b. c. Print the deck 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. 5. 6. Output must be labelled and easy to read Program must be documented with Name, Date, Program name, and description Submit zipped file with project, .cpp file, and screenshots of program output. The card deck Iwo of Clubs Three of Clubs Four of Clubs Five of Clubs ix of Clubs even of Clubs Eight of Clubs Nine of Clubs en of Clubs Jack of Clubs ueen of Clubs ing of Clubs ce of Clubs Two of Dianonds hree of Dianonds Four of Dianonds Five of Dianonds ix of Dianonds even of Dianonds Eight of Dianonds ine of Dianonds en of Dianonds ack of Dianonds en of Dianonds King of Dianonds ce of Dianonds wo of Hearts Three of Hearts Four of Hearts ive of Hearts ix of Hearts even of Hearts Eight of Hearts ine of Hearts en of Hearts Jack of Hearts een of Hearts King of Hearts ce of Hearts vo of Spades hree of Spades Four of Spades Five of Spades ix of Spades even of Spades Eight of Spades ine of Spades en of Spades een of Spades King of Spades ce of Spades rdi Four of Hearts ard2 Ace of Spades nd the winner is ard 2 wins Ace of Spades
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started