Answered step by step
Verified Expert Solution
Question
1 Approved Answer
intro to C++ To get a random integer in the range [a.bl: int r = rand()%(b-a+ 1) + a; Also add this line to the
intro to C++
To get a random integer in the range [a.bl: int r = rand()%(b-a+ 1) + a; Also add this line to the beginning of your mainO srand((int)(time(0))); and add the library#include at top We will discuss these things in class en our Your assignment is to write a single-player version of the casino card game Blackjack, also known as 21. The goal of the game Blakjack is to get cards whose total value comes closest to 21 without going over. Getting a card total over 21 is called "busting". The player will play against the dealer. There are 3 possible outcomes Player comes closer to 21 than the dealer or the dealer busts but the player did not bust >player wins the bet amount The dealer comes closer to 21 than the player or the player's total cxceeds 21 -> player loses. Note if both the player and the dealer bust, then the dealer wins. This is called the "house advantage Both player and dealer have the same total and neither player busts ->tie, no money is exchanged. . At each round of play, the player will be asked to enter their bet. They will then be given 2 cards. The player will repeatedly be asked if they want to draw another card. The player can continue to draw cards while their total is less than 21. After the player's turn is over, the dealer's cards are shown. The dealer's play is always the same: the dealer will continue to draw cards if their total is less than or equal to 16 A sample run is shown below. Assume the player starts with $100 and the game ends when the player is down to $0 or their amount exceeds $1,000. Also note the user is prompted to re-enter their bet amount if they try to bet more than they actually have You have $100. Enter bet: 200 You only have $100 to bet. Enter bet: 500 You only have $100 to bet. Enter bet: 50 Your cards are: Two of Diamonds Ten of Clubs Your total is 12. Do you want another card (y)? y You draw a: Seven of Clubs Your total is 19. Do you want another card (y)? n The dealer's cards are: Queen of Diamonds Six of Spades The dealer's total is 16Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started