Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help me, this is for a game of poker, I'm confused on the functions we need to create in C. example code // Authors:
please help me, this is for a game of poker, I'm confused on the functions we need to create in C.
example code
// Authors: Deitel & Deitel - C How to Program #include#include #include void shuffle (int wDeck[][13]); void deal (const int wDeck[][13], const char *wFace[], const char *wSuit[]); int main (void) { /* initialize suit array */ const char *suit[4] = {"Hearts", "Diamonds", "Clubs", "Spades"}; /* initialize face array */ const char *face[13] = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; /* initalize deck array */ int deck[4][13] = {0}; srand ((unsigned) time (NULL)); /* seed random-number generator */ shuffle (deck); deal (deck, face, suit); return 0; } /* shuffle cards in deck */ void shuffle (int wDeck[][13]) { int row = 0; /* row number */ int column = 0; /*column number */ int card = 0; /* card counter */ /* for each of the 52 cards, choose slot of deck randomly */ for (card = 1; card Adapted from Deitel & Deitel's CHow to Program 6th Edition (1) In order to complete the game of 5-card- draw poker, you should complete the following functions (a) (5 pts) Modify the card dealing function provided in the example code so that a five- card poker hand is dealt. (b) (5 pts) write a function to determine if the hand contains a pair (c) (5 pts) Write a function to determine if the hand contains two pairs. (d) (5 pts) write a function to determine if the hand contains three of a kind (e.g. three jacks) (e) (5 pts) Write a function to determine if the hand contains four of a kind (e.g. four aces (5 pts) Write a function to determine if the hand contains a flush (i.e. all five cards of the same suit) (g) (5 pts) Write a function to determine if the hand contains a straight (i.e. five cards of consecutive face values)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started