Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream> #include <string> using namespace std; struct MovieData { str

ID: 3610557 • Letter: #

Question

#include<iostream>
#include <string>
using namespace std;

struct MovieData
{
string title;
string director;
int year_released;
double running_time;

};


MovieData getInfo();

int main()

{
MovieData film1, film2;

film1 =getInfo();
film2 = getInfo();

cout << "Thetitle of the movie is: " << film1.title << endl;
cout << "The director is: " << film1.director<< endl;
cout << "The year released is: " <<film1.year_released << endl;
cout << "The running time is: " <<film1.running_time << endl;

cout << "Thetitle of the movie is: " << film2.title << endl;
cout << "The director is: " << film2.director<< endl;
cout << "The year released is: " <<film2.year_released << endl;
cout << "The running time is: " <<film2.running_time << endl;

return 0;
}

MovieDatagetInfo()

{
MovieData data;

cin >>data.title;
cin >> data.director;
cin >> data.year_released;
cin >> data.running_time;
return data;
}

Explanation / Answer

#include <iostream>

#include <string>

using namespace std;

structMovieData

{

MovieData() {

getInfo();

}

string title;

string director;

intyear_released;

doublerunning_time;

voidgetInfo();

};

voidMovieData::getInfo()

{

cout << "Enter Title: ";

cin >>title;

cout << endl<< "Enter Director: ";

cin >>director;

cout << endl<< "Enter Release Year: ";

cin >>year_released;

cout << endl<<"EnterRunning Time: ";

cin >>running_time;

}

voiddisplay( MovieData film1)

{

cout << "The title of the movie is: "<< film1.title <<endl;

cout<< "Thedirector is: " << film1.director <<endl;

cout<< "Theyear released is: " << film1.year_released <<endl;

cout<< "Therunning time is: " << film1.running_time <<endl;

}

intmain()

{

MovieData film1,film2;

display(film1);

display(film2);

system("pause");