Question: C++ 1.)Modify the following code to include struct members to hold the a movies production costs and first-year revenues; modify and test your functions accordingly

C++ 1.)Modify the following code to include struct members to hold the a movies production costs and first-year revenues; modify and test your functions accordingly the function to display MovieData information should display the first years profit (or loss).

#include

using namespace std;

//structure

struct MovieData {

string title, director_Name;

int year, length;

};

//method to read and store info

void getMovieData(MovieData& m)

{

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

cin >> m.title;

cout << "Enter Director name:";

cin >> m.director_Name;

cout << "Enter year of release:";

cin >> m.year;

cout << "Enter length of the movie in minutes:";

cin >> m.length;

}

//method to display output

void prntMovie(MovieData m)

{

cout << "Title:" << m.title << endl;

cout << "Director name:" << m.director_Name << endl;

cout << "Year of release:" << m.year << endl;;

cout << "Length:" << m.length << " minutes ";

}

int main()

{

//declaring objects

MovieData o1, o2;

//calling getMovieDAta

getMovieData(o1);

getMovieData(o2);

//calling prntMovie

prntMovie(o1);

prntMovie(o2);

return 0;

}

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!