Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will create a Deck class as follows: Compiles without error ( 1 point ) The constructor will create a full 5 2 - card
You will create a Deck class as follows:
Compiles without error point
The constructor will create a full card deck of cards. Jack, Queen, King, Ace for each suit: Clubs, Diamonds, Hearts, Spades. Each card will be created on the heap and the deck will be stored using an STL vector of Card pointers. points
The destructor will free the memory associated with each Card instance. points
A shuffle method will shuffle the Card pointers into an STL stack. Note that only the pointers will be added to the stack. Shuffle may be called at any time to "reshuffle". Reshuffling clears the stack and repopulates with the full deck. points
A draw method will allow the caller to receive a pointer to the Card on the top of the shuffled deck. The Card will be popped from the stack. points
Write a main function points that does the following:
Creates a deck of cards.
Shuffles the deck.
Draws cards and prints each one.
Reshuffles the deck.
Draws cards and prints each one.
You will turn in the following files. Please ZIP them into an archive before uploading.
card.h
card.cpp
deck.h
deck.cpp
main.cpp
Please show these and how the code in each works together to execute a cohesive program.
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