Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

How is sound energy dissipated in viscoelastic materials?

Answered: 1 week ago