Modify the program you submitted for HW4 to eliminate the
potential of dealing the same card more than once. In addition,
after printing the 20 cards dealt to the 4 players, your program
must print out the remaining 32 cards in the deck. Display the 32
cards in a table with 4 columns of 8 cards each.
- Use a double-subscripted (2-dimensional) array to keep
track of each card that is dealt to a player. YOU
MUST USE THE FOLLOWING DECLARATION IN YOUR PROGRAM:
to create an array that has exactly 52 elements.
DO NOT CREATE AN ARRAY WITH MORE THAN 52
- Before printing each card drawn from the deck, your
program must first check the array to see if the card has
already been dealt. If the card was not previously dealt
to a player, your program must display the card and then
modify the array to mark the card as being dealt. If the
card was already dealt, then your program must pick a new
- Create a user-defined function called PrintCard
to print the value and suit of each card to be displayed.
This function must include the 2 switch statements you
previously used in HW4. You will move the code out of
function main into this new function because you will use
this code to print both the 20 cards that were dealt to
the players and the 32 cards that were not dealt. The
function's prototype must look like this:
where the 2 integers in the parameter list are
the value and suit of the card to be printed. For
example, using the function call PrintCard(12,3);
should display Q of Spades on
- Display the 32 remaining cards of the deck in a table
with 4 columns of 8 cards each.
- Your main function MUST contain a
do/while loop to force your program to pick a card that
has not already been dealt to a player.
Paste the source code inside an e-mail message
to email@example.com and include HW5 in the Subject Line of the e-mail