Question: This is a simple game for 2 players. One card is dealt to each player, face up . The highest value card wins. If the
This is a simple game for players. One card is dealt to each player, face up The highest value card wins. If the
cards are the same, then its a tie. Announce the winner Game over. You will allow the users to play all cards
in the deck games.
You will have classes:
The Deck class which will create the deck of cards
The Card class which creates cards
The main logic of the game will be in the main program. You will use the Card class and the Deck class to play
the game.
Here are the class header information for each class. Use these classes and only these functions.
class Deck
Deck constructor which creates a deck of cards
Card deal deal a card
void display show all the cards in the deck
void shuffle shuffle the cards in the deck
class Card
Cardchar char constructor to create a card, setting the suit and rank
void display display the card example: ACS KD
int compareCard return for win, for tie, for lose
When you run your program the following will happen in this order:
A new deck will be created.
The program will ask for the names of the players.
The unshuffled deck will be displayed on the screen.
The deck will be shuffled.
The shuffled deck will display on the screen.
games will be played, announcing the winner of each game. Ties are possible as well.
After all games are played the program will print the statistics.
Things to consider:
How are you going to shuffle?
You MUST use a vector to store cards in your deck.
Use this command to compile your program:
g war.cpp card.cpp deck.cpp o war
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
