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);