Question: Overview: In this assignment, you will create a deck of cards using a Card struct: typedef struct { char *rank; char *suit; char *colour; }

 Overview: In this assignment, you will create a deck of cardsusing a Card struct: typedef struct { char *rank; char *suit; char*colour; } Card; Download the file cards.c. It contains starter code. ***

Overview: In this assignment, you will create a deck of cards using a Card struct: typedef struct { char *rank; char *suit; char *colour; } Card; Download the file cards.c. It contains starter code. *** Please fill in lines 1 and 2 of the cards.c file *** Your job is to complete the following functions: Card *make_deck (); void print (Card *); void shuffle (Card *); void print_to_file (FILE * , Card *); Do not change the prototypes of these functions. You are free to implement helper functions if you wish. Compile your program using: gcc -Wall -pedantic cards.c -std=c90 -0 cards Note: if you are developing your program on repl.it, give yourself enough time to debug it in a VM or WSL. Repl.it uses a different compiler and we can't add flags. You can still do initial development there, but you will need to run it through gcc with the above flags. *************** Example run: *************** Original Deck Black Spades King Black Spades Queen Red Diamonds 2 Red Diamonds Ace *************** Shuffled Deck *************** Black Clubs Jack Black Spades Jack Red Hearts 10 Black Clubs Ace Now that you have your program printing the output to the screen, add the print_to_file functionality to have your program print the decks to files called sorted.deck and shuffled. deck. The filenames should be passed in on the commandline when you run the program: ./ cards sorted.deck shuffled.deck To check your program for memory leaks run the valgrind tool: valgrind --leak-check=yes ./cards sorted.deck shufied. deck Save the output of valgrind by running: valgrind --leak-check=yes ./cards sorted.deck shufled.deck 2> valgrind.output Rubric (Breakdown of marks 25): 8 2 make_deck 0 print() shuffle style/comments/valgrind.output included Writing to file (Part 2) 5 5 *** These are free marks! Don't give them up! 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!