Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C LANGUAGE PLS 1. The problem to solve is the card game Blackjack. Students will use the code given and write the algorithm to

image text in transcribed

image text in transcribed

IN C LANGUAGE PLS

1. The problem to solve is the card game Blackjack. Students will use the code given and write the algorithm to play against the computer. The player will play against the computer, the dealer. It is your job to implement the logic of the game. Only two players, the dealer and one player, no double down, or betting, simply blackjack, win or lose, you may play five games for an overall winner. Remember, the A or Ace can be either a 1 or 11 depending on the hand. Also, players can have at most 5 cards. The goal is to reach 21 without going over and the one closest to 21 wins. The code will be in a text file as this is the best way to paste into the Visual Studio interface. Or if you take it from here, copy all of it to a text file and then safe, after the conversion you may insert into Visual Studio. As you look at the code give notice in the main printDeck as it is called before and after the shuffle to show that the deck is created properly. These lines of code should be taken out once the game begins, as clearly you do not want to show the user the order of the shuffled cards. Functions should be used to implement the logic. The game #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #define SUITS 4 #define FACES 13 #define CARDS 52 #define MAXCARDS 5 typedef struct charface; char* suit; int value; } Card; void printDeck (Card Weck); void shuffle(Card* wDeck); void fillDeck(Card* WDec, const char* wface[], const char* wSuit[]); int main(void) { Card deck[CARDS]; Card dealerHand[MAXCARDS ]; Card plyHand[MAXCARDS]; const char* face[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }; const char* suit[] = { "Hearts", "Diamonds", "Clubs", "Spades" }; srand(time(NULL)); fillDeck(deck, face, suit); printf("Deck is filled and not shuffled! "); printDeck(deck); shuffle(deck); printf("Deck is shuffled "); printDeck(deck); system("pause"); } void fillDeck(Card* weck, const char* WFace[], const char* wsuit[]) { for (int i = 0; i #include #include #include #define SUITS 4 #define FACES 13 #define CARDS 52 #define MAXCARDS 5 typedef struct charface; char* suit; int value; } Card; void printDeck (Card Weck); void shuffle(Card* wDeck); void fillDeck(Card* WDec, const char* wface[], const char* wSuit[]); int main(void) { Card deck[CARDS]; Card dealerHand[MAXCARDS ]; Card plyHand[MAXCARDS]; const char* face[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }; const char* suit[] = { "Hearts", "Diamonds", "Clubs", "Spades" }; srand(time(NULL)); fillDeck(deck, face, suit); printf("Deck is filled and not shuffled! "); printDeck(deck); shuffle(deck); printf("Deck is shuffled "); printDeck(deck); system("pause"); } void fillDeck(Card* weck, const char* WFace[], const char* wsuit[]) { for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

Find the following integrals. e* x- dx e* + e*

Answered: 1 week ago

Question

Why is a job analysis important?

Answered: 1 week ago