50 points Create a standard deck of 52 playing cards and list those cards on the
ID: 666605 • Letter: 5
Question
50 points
Create a standard deck of 52 playing cards and list those cards on the screen, columns makes my life easier :-) Pause or "press Enter" after the unshuffled deck is displayed. The display might look something like.
"Shuffle" the deck and list the shuffled deck on the screen. random_shuffle from <algorithm> will work on a vector of Cards
Sort (by rank) and evaluate evaluate the first 5 cards of the deck as a 'hand'. Print the unsorted, then the sorted hand.
a pair (say the card rank, like Pair of Queens)
two pair (say something like Pair of Queens and Pair of Twos)
three of a kind (say something like Three Kings)
full house (say something like Full house, Jacks over fours)
straight (say Ace-high straight) A straight is all 5 cards in rank order, ace can be high or low
four of a kind
flush (say something like spades flush)
Ideas:
create a Card class with an internal 'Rank' (A, 2, 3, 4, ..) and 'Suit' (spades, diamonds ...)
Here's one possible idea for a card class (Card.h)
Explanation / Answer
here is the closer sln
************card.cpp*****
****************
********************************
*******************
********************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.