Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that will create a deck of cards, initialize values and properties for cards, shuffle, and print out the deck. Make sure the
Write a program that will create a deck of cards, initialize values and properties for cards, shuffle, and print out the deck. Make sure the last line in your screen shot shows the date for review. See line 53 below. #include#include #include #define NCARDS 52 #define NPROPS 2 #define NSUITS 4 #define NFACES 13 // card text values using array of pointers to preinitialized constant text strings char* suit[NSUITS]={"hearts","spades","clubs","diamonds"}; char* face[NFACES]={"ace","two","three","four","five","six","seven","eight","nine", "ten","jack","queen","king"}; // function prototypes used for manipulating cards void PrintCard(int deck[NCARDS][NPROPS], int i); void InitDeck(int deck[NCARDS][NPROPS]); void SwapCards(int deck[NCARDS][NPROPS], int src, int dest); void ShuffleDeck(int deck[NCARDS][NPROPS]); int GetPlayValue(int deck[NCARDS][NPROPS], int i); int main() { //deck of cards // face, suite, card value int deck[NCARDS][NPROPS]; time_t rawtime=time(NULL); int i; srand(time(NULL)); // init the deck // loop on the chards InitDeck(deck); ShuffleDeck(deck); // print the deck puts("The shuffled deck is:"); for (i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started