Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

What key control concept was missing at Argus Productions?

Answered: 1 week ago

Question

=+What is your religion? Would you be able to perform the

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago