Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program to simulate a game of Blackjack between two to four players. Your program must incorporate a two-dimensional array to represent the suit and

C++ program to simulate a game of Blackjack between two to four players. Your program must incorporate a two-dimensional array to represent the suit and the value of each card dealt to a player, keep track of which cards have been dealt to which player, and use a random-number generator to pick each card to be dealt to a player.
// Assignment: Two-Dimensional Arrays
// Description: The program will use a 2D array and a random-number
// generation to play Blackjack and keep track of a playing-card deck.
// Input: User data entry and a playing-card deck represented as a two-
// dimensional array
// Output: A screen display showing the current card hands of each player
// and the dealer, their score, win and lose status, and a final representation
// of the card deck after the game is over
#include
#include
#include
using namespace std;
void main (void)
{
bool bPlayerDraw[5]; //Boolean to determine if player holds (F)
//or draws card (T)
char cPlay = 'N'; //Character variable for play game input
char cCardDeck[4][13]; //Character array representing the card deck
int iCard; //Card array index
//0 = 2 card
//1 = 3 card
//2 = 4 card
//3 = 5 card
//4 = 6 card
//5 = 7 card
//6 = 8 card
//7 = 9 card
//8 = 10 card
//9 = jack card
//10 = queen card
//11 = king card
//12 = ace card
int iNumberOfDraws = 0; //Number of rounds of card draws
int iSuit; //Suit array index
//0 = diamonds
//1 = hearts
//2 = clubs
//3 = spades
// ASCII character display reference for display card suit symbols
//3 = heart symbol
//4 = diamond symbol
//5 = club symbol
//6 = spade symbol
int iNumberOfPlayers = 0;//Number of players in current game
int iPlayerCount[5]; //Integer array to holder each player's count
//iPlayer[0] is always the dealer
int iHighestCount = 0; //Highest count for a single game
int k, m; //integer loop counters
srand(GetTickCount()); //Seed the random-number generator
//Main game loop
//Enter your code hereā€¦

Step by Step Solution

3.34 Rating (166 Votes )

There are 3 Steps involved in it

Step: 1

To implement the Blackjack game in C you will need to follow these steps Declare and initialize the variables that you will need to keep track of the game state such as the card deck the player hands ... 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

Quantitative Methods For Business

Authors: David Anderson, Dennis Sweeney, Thomas Williams, Jeffrey Cam

11th Edition

978-0324651812, 324651813, 978-0324651751

More Books

Students also viewed these Programming questions

Question

6. One representation of the Riemann zeta function ((2) is

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago

Question

Using (1) or (2), find L(f) if f(t) if equals: t cos 4t

Answered: 1 week ago