Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ / JUST C PROGRAMMING.. FOLLOWING CODE IS GIVEN JUST WRITE CODE FOR LAST 3 FUNCTIONS.... #include #include #include #define SUITS 4 #define FACES 1
JUST C PROGRAMMING.. FOLLOWING CODE IS GIVEN JUST WRITE CODE FOR LAST FUNCTIONS....
#include
#include
#include
#define SUITS
#define FACES
#define CARDS
#define HANDSIZE
#define HANDSINDECK
#define NUMBEROFHANDSPLAYED Currently set to million
#define NUMBHANDSSTR million" Currently set to million
#define TRUE
#define FALSE
int isFourOfAKindconst unsigned int hand;
int isPairconst unsigned int hand; return true if hand contains a pair and false otherwise
int isTwoPairconst unsigned int hand; return true if hand contains a two pair and false otherwise
int isThreeOfAKindconst unsigned int hand;
int mainvoid
define and initialize deck array
unsigned int deckCARDS;
initialize deck with values to CARDS
value caluclates suit # "Hearts", "Diamonds", "Clubs", "Spades" ;
value calculates face card Ace Jack, Queen, King
for sizet card ; card CARDS; card
deckcard card;
srandunsigned inttimeNULL; seed randomnumber generator
initialize suit array
const char suitSUITS
"Hearts", "Diamonds", "Clubs", "Spades" ;
initialize face array
const char faceFACES
"Ace", "Deuce", "Three", "Four",
"Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" ;
unsigned int twoPairCount ;
unsigned int threeOfAKindCount ;
int isFourOfAKindconst unsigned int hand
unsigned int faceCntFACES;
Calculate the frequency of each face card in the hand
In other words, it calculates how many Aces, deuces, s etc. in the hand of cards
for sizet card ; card HANDSIZE; card
faceCnthandcard FACES;
Iterate through all of the frequency counts to find out if
any face card occurred times in the hand
for sizet face ; face FACES; face
if faceCntface
return TRUE; Yes!!! Return true.
return FALSE; Nope ;
Returns true if hand contains only a pair and false other wise
NOTE: Will return FALSE if the hand contains any of these hand types as well:
Hand has pairs
Hand has of a kind
Hand is a full house
Hand has of a kind
int isPairconst unsigned int hand
Student implements this function
return FALSE;
Returns true if hand contains two pairs and false otherwise
NOTE: Will return FALSE if the hand contains any of these hand types as well:
Hand has of a kind
Hand is a full house
Hand has of a kind
int isTwoPairconst unsigned int hand
Student implements this function
return FALSE;
Returns true if hand contains of a kind and false otherwise
NOTE: Will return FALSE if the hand contains any of these hand types as well:
Hand has a full house
Hand has of a kind
int isThreeOfAKindconst unsigned int hand
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