Note
- Work on an request by yourself without sharing the answer to a classmate. (It is great that students study together but an request is an individual task. It is not a group project.)
- Start to do an request early and ask the teacher if you have a question.
- Add a comment with your name at the top of your source code
- Put all your files that you want to submit into one zip file
Please save the program with the name ‘cards.c’
Write a structure (struct card) that will represent a card in a standard deck of playing cards. You will need to represent both the suit (clubs, diamonds, hearts or spades) as well as the rank ( A, K, Q, J, 10, 9, 8, 7, 6, 5, 6, 7, 2) of each card. Note that a deck of playing cards can be represented as an array declared as
1
struct card deck[52];
Write a function that will perform a perfect shuffle on a deck of cards represented using the data structures from part a. In a perfect shuffle, the deck is broken exactly in half and rearranged so that the first card is followed by the 27th card, followed by the second card, followed by the 28th card, and so on.
Write a program that tests how many perfect shuffles are necessary to return the deck to its original configuration.