Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago