Question: ******************* C Programming ******************* TASK -1 struct Date { int day; int month; int year; }; struct Time { int hours; int min; }; struct
******************* C Programming *******************
TASK -1
struct Date { int day; int month; int year; };
struct Time { int hours; int min; }; struct Movie { int movieID; char movieName[127]; struct Date date; struct Time time; };
struct Cinema { struct Movie * movie; int cinemaID; };
struct Theatre { char theatreName[127]; struct Cinema* cinema; int count; };


Task 2 - Loading Data (25 Marks) Write a function (or collection of functions) that will read a list of movies from text files and populate a SuperFun Theatre. SuperFun Theatre data is saved in text files. The name of the theatre is shown on the first line of the file. After that, each line of the file will include information about the cinemas and movies. The Cinema is listed with its cinemald followed by all the movies shown in that cinema. The Movie data in the file is delimited by spaces in the following format: day/month/year hour:minute movie name The following is an example theatre file (Available to download on Moodle): "gold_street_data.txt" Gold Street Theatre Cinema 1 1/1/2021 12:20 Sarnac the Horgeheg 2 1/1/2021 15:45 Raiders of the Last Orc 1/1/2021 19:30 Tin Man Legacy 2/1/2021 12:20 Sarnac the Horgeheg 2 2/1/2021 15:45 Raiders of the Last Orc 2/1/2021 19:30 Tin Man Legacy 3/1/2021 12:20 Sarnac the Horgeheg 2 3/1/2021 15:45 Raiders of the Last Orc 3/1/2021 19:30 Tin Man Legacy Cinema 2 1/1/2021 12:20 Stare Wares Episode XII 1/1/2021 15:45 Detective Rabbit 3D 1/1/2021 19:30 Tin Man Legacy 2/1/2021 12:20 Sarnac the Horgeheg 2 2/1/2021 15:45 Detective Rabbit 3D 2/1/2021 19:30 Tin Man Legacy Your function should Take in a filename Dynamically allocate the structures you designed in Task 1. Read each movie and store it into an appropriate cinema. Return a pointer to a single theatre structure you designed in Task 1. If the file cannot be opened, your function should return NULL. An error message is not required
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
