Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ 1) Playing Card Class In this problem, you will implement a DeckofCards cdlass that simulates a deck of playing cards The class will utilize
C++ 1) Playing Card Class In this problem, you will implement a DeckofCards cdlass that simulates a deck of playing cards The class will utilize an important algorithm to "shuffle" the simulated card deck Part 1: Create an object class named DeckofCards that models a randomized deck of playing cards. Individual "cards" will be represented by integer values as follows: 0 1 2 3 45 6789 10 11 12 13 14 15 16 A 2 3456789 10JQKA2 34- . 51 Where the value 0 represents the Ace of the "first suit, 1 is the 2 of the first suit, 13 is the Ace of the "second" suit, and so on. The actual "suit" of the card will not be needed for now and can be ignored. Also note that in this problem we start counting with 0, rather than with 1 The DeckOfCards class should include the following private data members A 52 element integer array to represent the shuffled deck of cards An integer index to maintain the "next card" to be dealt from the deck The DeckOfCards class must also provide the following public (member) functions: A default constructor that will initialize the values of the card deck array with integer values 0.. 51, and then "shuffle the card deck (see description below) deck. If no cards remain, then the deck should be reshuffled (and reset) values in the card "deck using the Knuth Shuffle algorithm Given an array a with A member function dealCard) that will return the "next card value from the shuffled A member function shuffle () that takes no arguments and shuffiles (randomizes) the elements, the Knuth Shuffle algorithm is as follows FORi n-1 TO 1 REPEAT the following two lines: a pseudo-random integer from the interval 0
C++
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