+1 678 648 4277 

Instantiating a 52-card deck in C++ assignment help

In this assignment, you will create a C ++ application that creates an instance of a deck of 52 poker cards, shuffles them, and delivers a certain number of cards to two players. Our C++ assignment helpers store the cards in an array of length 52.
A function must be created that, given a card id, returns the name of the card (suit and rank). Create a function that deals 5 cards to two players, and calculates the value of each player's hand to determine a winner.

Creating an Instance of a 52-Card Deck

To solve this problem, a series of functions have been created where each one will execute a specific task. The GetCardName function receives an integer that represents the id of the card and a char array where the name of the card will be stored.

The ShuffleDeck function receives an integer array with the deck's cards and shuffles them.

The DealPokerHands function receives 3 arrays of integers: the first will contain all the cards on the deck, while the other two represent the hands of each player.

The HandValue function receives an integer array representing a player's hand and will calculate the value of the hand.

Finally, the WhoWins function receives two integer and two integer arrays, representing the hand and the value of each player's hand, and will return an int value with the winner's id.

#include #include #include "subs.h" Using namespace std; int main(void) { int i, cardNo, deck[52], hand1[5], hand2[5], change[5], v1, v2, winner; unsigned int seed; char ch, cardName[20], handtype1[20], handtype2[20]; /* PRELIMINARY CODE */ cout << "Steps 1-4:\nEnter a card number: "; cin >> cardNo; while (GetCardName(cardNo,cardName)) { cout << "Card Number " << cardNo << " is the " << cardName << ".\nEnter a card number: "; cin >> cardNo; } cout << "Enter a random seed: "; cin >> /* Start of program proper */ //srand(seed); //ShuffleDeck(deck); //DealPokerHands(deck,hand1,hand2);