Question

I need to build the card game of War in C++. It will be a 2...

I need to build the card game of War in C++. It will be a 2 player game. Each player will have their own deck of 52 cards. 2-10, Jack=11, Queen=12, King=13, Ace=14. Each player will draw one card from their deck. The player with the higher card wins both cards. If the card drawn is the same, then each player will draw 3 cards and on the 4th card drawn will show it. The player that shows the higher card wins all the cards. If there are not enough cards to draw 4, the players will draw what they have and show the last card. The player that has the highest card will win that round. 3 rounds must be played. The score of each player must be stored. The player who wins the most rounds out of the 3 rounds will win the game.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream.h>

#include<ctime.h>

#include<string.h>

string cardtypes[4]={"heart","club","spade","diamond"};

string deckcards[13]={"king","queen","jack","ace","two","three","four","five","six","seven","eight","nine","ten"};

int main()

{

string player;

int i;

for(i=1;i<=52;i++)

{

value=deckcards[i%13];

card=cardtypes[i/13];

}

Add a comment
Know the answer?
Add Answer to:
I need to build the card game of War in C++. It will be a 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program 4: C++ The Game of War The game of war is a card game played by children and budding comp...

    Program 4: C++ The Game of War The game of war is a card game played by children and budding computer scientists. From Wikipedia: The objective of the game is to win all cards [Source: Wikipedia]. There are different interpretations on how to play The Game of War, so we will specify our SMU rules below: 1) 52 cards are shuffled and split evenly amongst two players (26 each) a. The 26 cards are placed into a “to play” pile...

  • War—A Card game Playing cards are used in many computer games, including versions of such classic...

    War—A Card game Playing cards are used in many computer games, including versions of such classics as solitaire, hearts, and poker. War:    Deal two Cards—one for the computer and one for the player—and determine the higher card, then display a message indicating whether the cards are equal, the computer won, or the player won. (Playing cards are considered equal when they have the same value, no matter what their suit is.) For this game, assume the Ace (value 1) is...

  • 4. In one version of the game played by a dealer and a player, 2 cards...

    4. In one version of the game played by a dealer and a player, 2 cards of a standard 52-card bridge deck are dealt to the player and 2 cards to the dealer. For this exercise, assume that drawing an ace and a face card (Jack, Queen and King for each shape) is called blackjack. If the dealer does not draw a blackjack and the player does, the player wins. If both the dealer and player draw blackjack, a tie...

  • Problem 3 [25 pts (4(2,2),6,10,5)]: Information and Entropy An on-line card game uses a deck of 3...

    Problem 3 [25 pts (4(2,2),6,10,5)]: Information and Entropy An on-line card game uses a deck of 32 cards containing 4 Aces, 8 Kings, 16 Queens, 2 Jacks and 2 Tens. In each round of the game the cards are shuffled, the players make a bet about what type of card will be drawn, then a single card is drawn and the winners are paid off. The drawn card is reinserted into the deck before the next round begins i. How...

  • Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June...

    Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June 9th, 2018 @ 23:55 Percentage overall grade: 5% Penalties: No late assignments allowed Maximum Marks: 10 Pedagogical Goal: Refresher of Python and hands-on experience with algorithm coding, input validation, exceptions, file reading, Queues, and data structures with encapsulation. The card game War is a card game that is played with a deck of 52 cards. The goal is to be the first player to...

  • An on-line card game uses a deck of 32 cards containing 4 Aces, 8 Kings, 16...

    An on-line card game uses a deck of 32 cards containing 4 Aces, 8 Kings, 16 Queens, 2 Jacks and 2 Tens. In each round of the game the cards are shuffled, the players make a bet about what type of card will be drawn, then a single card is drawn and the winners are paid off. The drawn card is reinserted into the deck before the next round begins. i. How much information does a player receive when she...

  • This is a question for a stats course for science students... In one version of the...

    This is a question for a stats course for science students... In one version of the game played by a dealer and a player, 2 cards of a standard 52-card bridge deck are dealt to the player and 2 cards to the dealer. For this exercise, assume that drawing an ace and a face card (Jack, Queen and King for each shape) is called blackjack. If the dealer does not draw a blackjack and the player does, the player wins....

  • 2. (10 points) Suppose you are playing blackjack against a dealer. In a freshly shuffled deck, what is the probabil...

    2. (10 points) Suppose you are playing blackjack against a dealer. In a freshly shuffled deck, what is the probability that either you or the dealer is dealt a blackjack? (Recall the game of blackjack is played with each player obtaining two cards at random from a regular deck. We say these two cards form a blackjack if one card is an ace and the other card is either a 10, Jack, Queen or King) 2. (10 points) Suppose you...

  • C++ program This program involves writing a VERY simplified version of the card game War. You...

    C++ program This program involves writing a VERY simplified version of the card game War. You may know this game or not but my rules are these 1. Split the deck between player1 and player2. Only the face values matter (2-14) and not the suits 2. Each player puts a card down on the table. The higher face value wins that hand. If the card values match, you will simply indicate tie and neither player wins.The original rules would require...

  • Hello, I need help with Question 7. Please show all the steps and the solutions of the problem. Thank you very much. 7. Consider a game that consists of drawing a single card at random from a standar...

    Hello, I need help with Question 7. Please show all the steps and the solutions of the problem. Thank you very much. 7. Consider a game that consists of drawing a single card at random from a standard deck of 52 cards. You pay S3 to play the game, and the money is not returned. If you draw an ace, you win S10. If you draw a king or queen, you win S5. How much should you expect to win...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT