Question: Create a simple program in C [blackjack.c] that deals two random cards to two players [the Player and the Dealer]. Display the cards dealt. Determine

Create a simple program in C [blackjack.c] that deals two random cards to two players [the Player and the Dealer]. Display the cards dealt. Determine a score for each player as the sum of both their cards, with all face cards being worth 10 and the Ace being worth 11. Display both scores and determine the winner as the player with the higher score.

Expand the blackjack program to allow the player to "hit" to get more card until they are satisfied (stand) or they go over 21 (bust). Modify the initial display of the deal to only show one of the Dealer's cards. If the player's starting score is 21, it is an automatic win. But, if the dealer's score is a 21, at the end, the player loses. Otherwise, prompt the player to either (1) Hit or (2) Stand. If the player hits, deal them another random card and add it to their score. For simplicity, handle the Ace the following way: If +11 will not go over 21, give +11; otherwise give +1. If score is over 21, the player has lost. Display "bust" and end the round. Otherwise, give them the opportunity to hit or stand again. Repeat this until the player busts or stands.

Expand the blackjack program to play out the dealer's hand. After the player's turn is over (and player didn't bust), show the Dealer's second card. The dealer will automatically hit anything 16 or under. Continue "hitting" the dealer until they pass 16 or bust. (Note that the "simple" way we are handling the Ace does not support Soft-17 play.) If the dealer busts, the player automatically wins. Otherwise, compare the scores to determine a winner. Prompt to play another round.

please use variable such as card, dealer, player1 etc.

Im very new at coding and need something simple in C program please. Thank you.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!