Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming Modify the card shuffling and dealing program below so that shuffling and dealing operations are performed in the same function (Shuffle_And_Deal). The function

C programming

Modify the card shuffling and dealing program below so that shuffling and dealing operations are performed in the same function (Shuffle_And_Deal). The function should have only one nested looping structure that is similar to the function shuffle..

image text in transcribed

image text in transcribed

I // Fig. 7.24: fig07_24.c 2 // Card shuffling and dealing #include #include 5 #include 7 #define SUITS 4 8 #define FACES 13 #define CARDS 52 10 II // prototypes 12 void shuffle(unsigned int wDeck [] [FACES]); // shuffling modifies wDeck 13 void deal (unsigned int wDeck [] [FACES], const char *wFace] 14 15 16 int main(void) 17 18 19 20 21 const char *wSuit[); // dealing doesn't modify the arrays // initialize deck array unsigned int deck[SUITS] [FACES] t0; srand (time (NULL); // seed random-number generator shuffle(deck); // shuffle the deck 23 24 // initialize suit array 25 26 27 28 / initialize face array 29 30 3 1 32 const char *suit[SUITS] "Hearts", "Di amonds", "Clubs", "Spades" const char *face [FACES] ["Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"; deal (deck, face, suit); // deal the deck 34 35 36 I // Fig. 7.24: fig07_24.c 2 // Card shuffling and dealing #include #include 5 #include 7 #define SUITS 4 8 #define FACES 13 #define CARDS 52 10 II // prototypes 12 void shuffle(unsigned int wDeck [] [FACES]); // shuffling modifies wDeck 13 void deal (unsigned int wDeck [] [FACES], const char *wFace] 14 15 16 int main(void) 17 18 19 20 21 const char *wSuit[); // dealing doesn't modify the arrays // initialize deck array unsigned int deck[SUITS] [FACES] t0; srand (time (NULL); // seed random-number generator shuffle(deck); // shuffle the deck 23 24 // initialize suit array 25 26 27 28 / initialize face array 29 30 3 1 32 const char *suit[SUITS] "Hearts", "Di amonds", "Clubs", "Spades" const char *face [FACES] ["Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"; deal (deck, face, suit); // deal the deck 34 35 36

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

What are Electrophoresis?

Answered: 1 week ago