Figure 6-41 shows the start of a typical program execution


Create a simplified version of the card game poker. Reuse the fillDeck()and selectCard()functions from Exercise 19 to create an array of 52 cards and randomly deal five cards each to two players-the computer and the user. Create another function that determines the winner of the poker hand. In this simplified version, a player with the most matching cards wins. In other words, a player with a pair beats a player with no pairs, and a player with three of a kind, beats a player with just a pair. In this simplified version, straights and flushes do not matter. If both players have the same number of matches, then the hand is considered to be a tie. Save the program as SimplifiedPokerCardGame.cpp.

Exercise 19:

In the card game War, a deck of playing cards is divided between two players. Each player exposes a card and the player who exposes the card with the higher value, wins (that is, takes possession of ) both exposed cards. Create a computerized game of War in which a standard 52-card deck consisting of 13 values in each of four suits is randomly divided between two players. Reveal one card for the computer and one card for the player at a time. Score 2 points for the opponent holding the card with the higher value. (For this game the king is the highest card, followed by the queen and jack, then the numbers 10 down to 2, and the ace is lowest.) If the computer and the player are tied, score one point for each. At the end of the game, all cards should have been played with no repetition. That is, if the queen of hearts has been played in a game, it cannot be played again. At the end of the game, the sum of the player's score and the computer's score will be 52
Use an array of 52 integers to store unique values for each of the 52 playing cards. Write a function named fillDeck()that places 52 unique values into this array. Write another function named selectCard()that you call twice on each deal to uniquely select one card for each player, with no repetition of cards in 26 deals.

Figure 6-41 shows the start of a typical program execution. By the end of the game, 26 hands will have been dealt and a total of 52 cards will have been acquired by the two players.

Save the program as WarCardGame.cpp. Caution: This is a difficult exercise!

2215_8cd9aefd-4ec6-40d0-bc6b-6df48fa96f55.png

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Figure 6-41 shows the start of a typical program execution
Reference No:- TGS02192763

Expected delivery within 24 Hours