Creat a blackjack game (in C program) using structs to represents the playing ca
ID: 3569338 • Letter: C
Question
Creat a blackjack game (in C program) using structs to represents the playing cards.
struct card
{ char*rank;
char*suit;
int value;
};
Make an array of 52 card structs and write a shuffle function. In main,deal two cards to the dealer and two cards to the player. Allow the player to get additional card (take a hit) until he/she stops or goes over 21 points (busts). Next, the dealer takes cards until he/she reaches 17 or busts. Finally, compare the two hands to see who has won-print congratulations. If tine permits, add code to allow betting and to play multiple times.
Explanation / Answer
#include #include using namespace std; typedef enum { VALUE, JACK, QUEEN, KING, ACE } FACE; typedef struct { int value; FACE f; } CARD; void print_card(CARD c) { if (c.f == ACE) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.