Hi Everyone,
i dont expect that someone will write this program, but still its a challange for C++ Programing lovers. Try to make this program simplier as you can. if you required any more info, you can ask by replying to this thread.
Here is the C++ Program Description:
Write a program that determines the score of a blackjack hand. In blackjack, a player receives
from two to five cards. The cards 2 through 10 are scored as 2 through 10 points respectively. The
picture cards jack, queen and king are scored as 10 points each. The goal is to come as close to a
score of 21 as possible without exceeding 21. Hence, any score over 21 is called “busted.” The
ace can count as either 1 or 11, whichever is better for the player.
Some examples:
• A player who receives two cards, 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.
• A player who receives three cards, 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.
• A player who receives five cards, three aces and two 4’s can be scored as either 11, 21,
31 or 41. The best score for this hand is 21.
• A player who receives four cards, two aces and two 10’s can never be scored below 22.
So, output will be “busted”.
The user is asked how many cards he/she has and the user responds with one of the integers 2, 3, 4 or 5.
The user is then asked for card values. Card values are 2 through 10, jack, queen, king and ace. A
good way to handle input is to use the type char so that the card input 2, for example, is read as
character ‘2’. Input the values 2 through 9 as the characters ‘2’ through ‘9’. Input the values ten,
jack, queen, king and ace as the characters ‘t’, ‘j’, ‘q’, ‘k’ and ‘a’. You should allow upper as well
as lowercase letters as input. You can assume that a player can receive at most five cards of same
value or of different values.
After reading the values the program should convert them from character values to a numeric
card score taking special care for aces. The output is either a number between 2 and 21 or the
word “busted.”
------------------------------------------------------------------------------------------------------
if you can make this program, it would be the great help for those who are still learning C++ Programing, like me.
Thanks In Advance .....
Best Regards,
Umar Ejaz