Create an array of 52 elements where each element represents a card in a deck of
ID: 3532235 • Letter: C
Question
Create an array of 52 elements where each element represents a
card in a deck of playing cards. Also, use the values 0-51 to
represent the 52 different cards in the deck (4 suits, 13
values per suit):
13 Clubs: Ace, 2-10, Jack, Queen, King
13 Diamonds: Ace, 2-10, Jack, Queen, King
13 Hearts: Ace, 2-10, Jack, Queen, King
13 Spades: Ace, 2-10, Jack, Queen, King
Write functions to do the following:
1) deal a card from the deck
2) display a card, indicating suit and value
3) shuffle the deck
Write a "driver program" to test your functions and show that
your functions and deck appear to be working properly. Have the
driver program deal a set of five cards from your deck.
Notes:
-----
- When dealing, the card dealt should no longer be in the deck
- Develop an algorithm/formula to convert the values 0-51 into
a unique card in the deck. Each number should correspond to
one specific card
- Shuffling should "randomly" reorder the deck
Explanation / Answer
http://ideone.com/SBAzmJ
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.