Question: Using C++ write a program that uses a structure named MovieData to gather and store the following information about a movie: Title Director Year Released

Using C++ write a program that uses a structure named MovieData to gather and store the following information about a movie: Title Director Year Released Running Time (in minutes) Production cost and First-year revenue. The program should create two MovieData variables, store values in their members, and pass each one, in turn, to a function that displays the information about the movie in a clearly formatted manner.

So far I have this but need to debug and create a display.

#include

#include

#include

using namespace std;

struct movieData

{

string title;

string director;

int year;

int runTime;

int prodCosts;

int filmRev;

};

int main()

{

cout<< "\t\tFilm Comparison Program! ";

for(int i=1; i<3; i++)

{

movieData m[i];

// Variables

// Prompt user for information

cin.ignore();

cout << "Enter the title of the movie: ";

getline(cin, m[i].title);

while (m[i].title.length()<=0) {

cout<<"Movie's tittle is required. \t Enter movies's tittle: ";

getline(cin, m[i].title);

}

cout << "Enter the name of the movie's director: ";

getline(cin, m[i].director);

while (m[i].director.length()<=0) {

cout<<"Director's name required. \t Enter Director's name:";

getline(cin, m[i].director);

}

cout << "Enter the year the movie was released: ";

cin >> m[i].year;

while (m[i].year<=0) {

cout<<"Movie's release date is required. \t Enter the year movie was released: ";

cin >> m[i].year;

}

cout << "Enter the running time of the movie in minutes: ";

cin >> m[i].runTime;

while (m[i].runTime<=0) {

cout<<"Movie's length is required. \t Enter the movie's length: ";

cin >> m[i].runTime;

}

cout << "Enter the production cost of the movie: $";

cin >> m[i].prodCosts;

while (m[i].prodCosts<=0) {

cout<<"Movie's production cost is required. \t Enter the movie's production cost: $";

cin >> m[i].prodCosts;

}

cout << "Enter the movie's first year revenue: $";

cin >> m[i].filmRev;

while (m[i].filmRev<=0) {

cout<<"Movie's first year revenue is required. \t Enter the movie's first year revenue: $";

cin >> m[i].filmRev;

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!