Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students explore these related Databases questions

Question

=+working on a micro-multinational?

Answered: 3 weeks ago