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
Hearts-K
Clubs-Q
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
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