Question
answer in C++ Movie Vector Write a program that allows the user to enter movie information, which is then stored in a vector. The user
answer in C++
Movie Vector
Write a program that allows the user to enter movie information, which is then stored in a vector. The user should enter data for at least one movie, but the program should ask if they have additional information to enter. When the user has indicated that they are done entering movie data, the program should output the information stored in the vector
You should use:
A struct called Movie to store the following information:
Title
Director
Year Released
Running Time (in minutes)
A vector of type Movie to store the information
A function that allows you to obtain the data. The function should have a reference to a movie variable as a parameter, but does not return a value. (Tip: as in the class example the variable should receive all the data before it is inserted into the vector. Insert enough data for at least two movies for this exercise.
A function to output the movie data that was entered. This function should accept two parameters: a vector and an integer (for the size of the vector).
Tip: In case youre wondering, the header for the function that uses a
vector should have a typical vector declaration within the parentheses.
Recall: To declare a vector, include the vector template and use the general
syntax: vector
Sample output is shown below:
Enter the title of the movie: The Dark Knight
Enter the director's name: Christopher Nolan
Enter the year the movie was created: 2008
Enter the movie length (in minutes): 152
Do you have more movie info to enter?
Enter y/Y for yes or n/N for no: y
Enter the title of the movie: The Avengers
Enter the director's name: Joss Whedon
Enter the year the movie was created: 2012
Enter the movie length (in minutes): 143
Do you have more movie info to enter?
Enter y/Y for yes or n/N for no: Y
Enter the title of the movie: Deadpool
Enter the director's name: Tim Miller
Enter the year the movie was created: 2016
Enter the movie length (in minutes): 108
Do you have more movie info to enter?
Enter y/Y for yes or n/N for no: n
Here is the info that you entered:
Movie Title: The Dark Knight
Movie Director: Christopher Nolan
Movie Year: 2008
Movie Length: 152 minutes
Movie Title: The Avengers
Movie Director: Joss Whedon
Movie Year: 2012
Movie Length: 143 minutes
Movie Title: Deadpool
Movie Director: Tim Miller
Movie Year: 2016
Movie Length: 108 minutes
____________________________________________________________________
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