Write a C++ program of playing cards game. The game consists of the following
rules:
(20 marks)
● The game has two players, with each player taking one turn each.
● Each player receives from two to five cards from the deck. (The 1st player decides how
many will be distributed to each)
● There are a total of maximum 52 cards in the deck. A "standard" deck of playing cards
consists of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs.
Each suit contains 13 cards: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King. .
● The cards 2 through 10 are scored as 2 through 10 points each. The face cards —Jack,
Queen and King — are scored as 10 points.
● The goal is to come as close to a score of 21 as possible without going over 21.
● Hence, any score over 21 is called “busted”.
● The ace card can count as either a 1 or 11, whichever is better for the user. For
example, an ace and a 10 can be scored as either 11 or 21. Since 21 is a better score,
this hand is scored as 21. An ace and two 8’s can be scored as either 17 or 27. Since 27
is a “busted” score, this hand is scored as 17.
The gameplay is given below:
● The 1st player is asked how many cards each player will receive, and the user responds
with one of the integers 2, 3, 4, or 5. Only one card value is chosen by each player - the
user choose any card except ace, while the rest of the cards are generated through
random values (ace can occur in random values). A good way to handle input is to use
the type char so that the card input 2, for example, is read as the character ’2’, rather
than as the number 2. Input the values 2 through 9 as the characters ’2’ through ’9’.
Input the values 10, jack, queen and king as the characters ’t’, ’j’, ’q’, ’k’, and ’a’. Be sure
to allow upper- as well as lowercase letters as input. After reading in the values, the
program should convert them from character values to numeric card scores. The output
for a particular player is either a number between 2 and 21 (inclusive) or the word
Busted. After turns of both players, the program shows the winner of the game (in case
one/both players scores under 21)