Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function to read in some movies' and actors' descriptions. Your function needs to allocate an array of movies and return it. The movie
Write a function to read in some movies' and actors' descriptions. Your function needs to allocate an array of movies and return it. The movie array needs to be filled with contents that are given through standard input (scanf). The input format is as follows. The first line contains an integer M with the number of movies to store. Following this will be M movie descriptions. The first line of each movie description contains the number of actors, A, followed by the title, the two being separated by a single space. The movie title will be at most 20 characters (none of which will be a space). The following A lines will contain the actor descriptions. The actor description will be a single line containing the name (at most 20 characters none of which will be a space), the birth year, and the salary, each of which will be separated by a single space. Example input: 3 badMovie 2 betterMovie ActorOne 2000 30000 ActorTwo 1985 50000 3 goodMovie ActorOne 2000 30000 ActorThree 1972 600000 ActorFour 1993 321321 Use the following structs and function prototype. typedef struct movie movie; typedef struct actor actor; struct movie { int num_actors; char * title; actor * actor_array, }; struct actor { char * name; int birth_year; int salary: }; movie * readMovies(); Write a function to read in some movies' and actors' descriptions. Your function needs to allocate an array of movies and return it. The movie array needs to be filled with contents that are given through standard input (scanf). The input format is as follows. The first line contains an integer M with the number of movies to store. Following this will be M movie descriptions. The first line of each movie description contains the number of actors, A, followed by the title, the two being separated by a single space. The movie title will be at most 20 characters (none of which will be a space). The following A lines will contain the actor descriptions. The actor description will be a single line containing the name (at most 20 characters none of which will be a space), the birth year, and the salary, each of which will be separated by a single space. Example input: 3 badMovie 2 betterMovie ActorOne 2000 30000 ActorTwo 1985 50000 3 goodMovie ActorOne 2000 30000 ActorThree 1972 600000 ActorFour 1993 321321 Use the following structs and function prototype. typedef struct movie movie; typedef struct actor actor; struct movie { int num_actors; char * title; actor * actor_array, }; struct actor { char * name; int birth_year; int salary: }; movie * readMovies()
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