Card shuffling and dealing create a program to shuffle and


Question: (Card Shuffling and Dealing) Modify the program you developed in Exercise so that it deals a five-card poker hand. Then write functions to accomplish each of the following:

a) Determine whether the hand contains a pair.

b) Determine whether the hand contains two pairs.

c) Determine whether the hand contains three of a kind (e.g., three jacks).

d) Determine whether the hand contains four of a kind (e.g., four aces).

e) Determine whether the hand contains a flush (i.e., all five cards of the same suit).

f) Determine whether the hand contains a straight (i.e., five cards of consecutive face values). Card Shuffling and Dealing Projects

Exercise: (Card Shuffling and Dealing) Create a program to shuffle and deal a deck of cards. The program should consist of class Card, class Deck Of Cards and a driver program. Class Card should provide:

a) Data members face and suit of type int.

b) A constructor that receives two ints representing the face and suit and uses them to initialize the data members.

c) Two static arrays of strings representing the faces and suits.

d) A to String function that returns the Card as a string in the form "face of suit." You can use the + operator to concatenate strings.

Class Deck Of Cards should contain:

a) A vector of Cards named deck to store the Cards.

b) An integer current Card representing the next card to deal.

c) A default constructor that initializes the Cards in the deck.

The constructor should use vector function push back to add each Card to the end of the vector after the Card is created and initialized. This should be done for each of the 52 Cards in the deck.

d) A shuffle function that shuffles the Cards in the deck. The shuffle algorithm should iterate through the vector of Cards. For each Card, randomly select another Card in the deck and swap the two Cards.

e) A deal Card function that returns the next Card object from the deck.

f) A more Cards function that returns a bool value indicating whether there are more Cards to deal. The driver program should create a Deck Of Cards object, shuffle the cards, then deal the 52 cards.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Card shuffling and dealing create a program to shuffle and
Reference No:- TGS02405775

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)