Question
Play cards creates a deck of cards, shuffles them, and then lists them out. Modify the program to 'deal' two hands of cards (two players). Each player will be dealt 5 cards. Deal one to the first player, then one to second player. Repeat until both players have 5 cards in their hand. Then compute the total points in each player's hand and determine the winner with the most points. If a player has an ace, then count that as 11 points. Print out the winning player total points and then his cards. Then print out the losing player total points and his cards. Turn in both your code and a copy of the screen output.
Explanation / Answer
#define NCARDS_PP 5 pl1_points printf(" Player 2 wins "); else printf(" Tie, no one wins "); return 0; } the print order is different from the requirements Cards of player 1 Card 1 = face of suit - Value = xx Card 2 = face of suit - Value = xx Card 3 = face of suit - Value = xx Card 4 = face of suit - Value = xx Card 5 = face of suit - Value = xx Total points for player 1 = xx Cards of player 2 Card 1 = face of suit - Value = xx Card 2 = face of suit - Value = xx Card 3 = face of suit - Value = xx Card 4 = face of suit - Value = xx Card 5 = face of suit - Value = xx Total points for player 2 = xx Player 1 wins ..or.. Player 2 wins ..or.. Tie, no one wins edit correction of the function ShuffleDeck. it could be that src and dest is the same because dest is generated randomly. in this case a call of SwapCards makes no sense. void ShuffleDeck(int deck[NCARDS][NPROPS]) { int src, dest; for (src=0; src