Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... 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_2

Step: 3

blur-text-image_3

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

Introduction to Algorithms

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

3rd edition

978-0262033848

More Books

Students also viewed these Programming questions