Question: C Program - Creating a linked list of an UNO Deck from a file ofinformation. Basically I have to program the card game of UNO

C Program - Creating a linked list of an UNO Deck from a file ofinformation.

Basically I have to program the card game of UNO in C. To start,I am asked to implement the deck by using a linked list. I am giventhe struct

typedef struct card_s {

char suit [7];

int value;

char action[15];

struct card_s *pt;

} card;

The 108 cards of UNO are also stored in a file containing textlike:

"Red 9 normal

Red 20 reverse

Blue 8 normal

Yellow 20 draw-2

etc..."

How would I take that file of information and organizeit into a linked list? I was the one who created the textfile containing the information for the cards, so I can changeit/reorganize it if it would be easier.

Also is there an easy way to shuffle that linked list aftercreating it? That way I can call a shuffle function to randomizethe cards at the beginning of the game?

Step by Step Solution

3.36 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To organize the information from the file into a linked list you can use the following steps 1 Open the file using the fopen function and read the car... View full answer

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 Programming Questions!