In this assignment you may receive help only from the class teaching assistants and the class professor. You may work in groups of up to two for this assignment. No sharing of code between groups.
Objective: The objective of this assignment is to gain experience with arrays, strings, pointers and functions.
For
this project you will write a program that deals five five-card poker hands,
evaluates each hand, and prints out a message indicating the type of hand,
e.g., two of a kind, full house, etc.
You
may use and modify the program from the text in Fig. 5.24, which you can
download from: www.ececs.uc.edu/~annexste/Courses/cs1/ch05/Fig05_24.cpp
You
are to modify that program so that the card dealing function deals five
five-card poker hands. In addition, you are to write seven functions to
accomplish each of the following tasks:
a)
Determine if the hand contains a pair.
b)
Determine if the hand contains two pairs.
c)
Determine if the hand contains three of a kind (e.g., three jacks).
d)
Determine if the hand contains a straight (i.e., five cards of consecutive face
values).
e)
Determine if the hand contains a flush (i.e., all five cards of the same suit).
f) Determine if the hand contains a full-house (i.e., three fives and two queens).
g)
Determine if the hand contains four of a kind (e.g., four aces).
For
each hand dealt, your program should print out one message indicating the type
of hand. For example, a sample output
might be…
Hand
number 1 is:
Eight
of Spades Jack of Spades
Deuce
of Spades Eight of Hearts
Five
of Clubs
The
hand contains a pair of Eights.
Hand number 2 is:
Jack of Spades Seven of Hearts
Ace of Clubs Six of Diamonds
Four of Hearts
The
hand contains no pair.
Hand number 3 is:
Five of Hearts Three of Spades
Queen of Diamonds Queen of Spades
Seven of Spades
The hand contains a pair of Queens.
Etc.
Extra
Credit: For extra credit you can write an evaluation function that
can be used to determine which is the best hand. Your function should return an
integer that can be used to compare two hands
-- the better hand always having the larger value. Use the function to
determine which of the five dealt hands is best.