1. Selection control structures; if, if-else; multiple alternative
2. Good programming style
a. Reasonable comments/documentation
b. Good variable names
c. Whitespace & indentation
You
will write a program that will compute the value of a hand of three playing
cards. The hands will be one of the possible hands listed in the table at
right.
This is similar to 5 card poker, but two pairs, a full house (three of one kind and a pair of another) and four of a kind are no longer possible.
A card is represented by an integer. 0 is to be an ace and thus the other aces in the deck, which is represented by the integers 0 to 51, are 13, 26 and 39. The kings are numbered 12, 25, 38 and 51. It is assumed that there is only one deck of cards. A hand will be generated using a random number generator. In your program, to generate a hand randomly, use the statements in the box at right. You must include <stdlib.h> and <cmath> in your program to make the random functions and time functions, respectively, available.
Note
that the illegal input result of the Three Card Hand
is caused
by two or more cards having the same value.
There
are two key tests that must be performed frequently… (use cut and paste…)
The
previous two questions must be answered (possibly multiple times) for each of
the following:
i.
Making
sure there are no duplicates
i.
Test1 3 times
i.
Test1 3 times
i.
Test2 3 times
.... etc;
Your
program should get three cards by inputting them, gets the result of the hand
and prints the hand and its result.
Check
for, in order, illegal input, three of a kind, pair, straight flush (and if so,
is it royal?), flush, straight. Ace can be high or low, that is, Ace-Two-Three
and Queen-King-Ace are both straights.
Turnin:
Your
project, named project2.cpp (all
lower case). 2 point penalty for non-compliance.