Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the C++ code using the folloing: Define a struct named MovieData to store the following information about a movie: Field Name Data Type Description

Write the C++ code using the folloing:

Define a struct named MovieData to store the following information about a movie:

Field Name Data Type Description title string Movie Title director string Movie Director yearReleased int Year Realesed runningTime double Running Time in Minutes Given functions are:

int populateIntegerArray(string *arrayPtr, int arraySize);

int findMaximumInteger(string *arrayPtr, int arraySize);

void displayIntegerArray(string *arrayPtr, int arraySize);

Process: 1) Enhaance the function to work with MovieData structs instead of integers if needed.

2) Allocate memory from an array of MovieData structs, instead of array of integers.

3) populate the array with input from the user.

4)Display the array content.

5)Find the longest movie in the array (the movie with the longest runningTime value).

sample output:

Enter desired array size: 3

arrayPtr = 0038B514

Enter Title 0: 2001:A Space Odyssey

Enter Director 0: Stanley Kubrick

Enter Year Released 0: 1968

Enter running time (minutes) 0: 142

Enter Title 1: The Sound of Music Enter Director 1: Robert Wise Enter Year Released 1: 1965 Enter running time (minutes) 1: 174 Enter Title 2: Finding Nemo Enter Director 2: Andrew Stanton Enter Year Released 2: 2003 Enter running time (minutes) 2: 100 0038B514: arrayPtr[0] = Title : 2001: A Space Odyssey Director : Stanley Kubrick Released : 1968 Running Time: 142 minutes 0038B554: arrayPtr[1] = Title : The Sound of Music Director : Robert Wise Released : 1965 Running Time: 174 minutes 0038B594: arrayPtr[2] = Title : Finding Nemo Director : Andrew Stanton Released : 2003 Running Time: 100 minutes Longest Movie in list: Title : The Sound of Music Director : Robert Wise Released : 1965 Running Time: 174 minutes Longest Movie is: 174 minutes long DELETING array at arrayPtr = 0038B514

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

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Determine the amplitude and period of each function.

Answered: 1 week ago