Write and compile a C++ program to simulate a deck of cards. A card is a C++ str
ID: 3654820 • Letter: W
Question
Write and compile a C++ program to simulate a deck of cards. A card is a C++ struct with both a suit (1 through 4) and a rank (1 through 13). A class CCardDeck provides the required functionality of a deck, as shown below. This class also includes a more involved member function to shuffle a deck. There are many ways to shuffle a deck. One approach is to divide a deck into two smaller decks. From here, the original deck is recreated by taking a few (random number of) cards at a time, from each of the two smaller decks, and placing them on the original deck. As an added note, the main function must also initialize the random number generator (srand(time(NULL)) where time(...) is in the file). A sketch of a possible interface of the CCardDeck class is given as follows, that is public: constructor (initialize a deck with the 4Explanation / Answer
//client.cpp #include "DeckOfCards.h" int main() { Deckofcards deckofcards; deckofcards.shuffle(); deckofcards.deal(); return 0; }//end main //DeckOfCards.h class Deckofcards { public: Deckofcards(); void shuffle(); void deal(); private: int deck[4][13]; };
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.