Question: Write a C++ program that holds a standard deck of cards with suites Diamonds, Clubs, Spades, and Hearts (each suite has 13 cards: 1-10, J,

Write a C++ program that holds a standard deck of cards with suites Diamonds, Clubs, Spades, and Hearts (each suite has 13 cards: 1-10, J, Q, K). You need to figure out how to define the deck in your program. Your code will interact with the user and draw a specific card the user requests, as in:

Spades-5 //your code draws the 5 of Spades and puts it aside

Hearts-K

Clubs-Q Hearts-10

Your code should keep track of which cards have been drawn from the deck. The drawn cards are not put back into the original deck. You must use vectors instead of arrays to store both the deck and drawn cards.

As soon as the user has drawn a pair (e.g., Clubs-3 and Spades-3 is a pair) OR three of a kind (e.g., Hearts-8, Hearts-J, Hearts-4), it should print out all the cards remaining in the deck in a file called cards.txt and exit. Organize the output such that the cards are grouped in cards.txt based on their suites (e.g., Clubs followed by Diamonds, followed by Hearts, followed by Spades). Print the total number of draws on the console, e.g.:You have drawn a total of 8 cards

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!