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

C++ Assignemnt Your goal is to create a structure to store information about a m

ID: 3717153 • Letter: C

Question

C++ Assignemnt

Your goal is to create a structure to store information about a movie.
Your program should have the following:
? The name of the program should be Assignment8.
? 3 comment lines (description of the program, author, and date).
? Write a program that uses a structure named MovieData to store the following information about a movie: (3 points)
o Title
o Director
o Year Released
o Running Time (in minutes)
? The program should create 2 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. (7 points)

Explanation / Answer

//description of the program : Passing structure variable as parameter to a function
// author :
//date : April 26,2018
#include <iostream>
using namespace std;

struct MovieData // structure definition
{
string title;
string director;
int yearReleased;
int runningTime;
};

void display(struct MovieData md) // function to display structure
{
cout<<"Title of Movie : "<<md.title;
cout<<" Director of Movie : "<<md.director;
cout<<" Releasing Year : "<<md.yearReleased;
cout<<" Running time : "<<md.runningTime<<" minutes";
cout<<endl;
}
int main() {

struct MovieData md1 = {"Jurrassic Park","Steven Spielberg",1993,127};
display(md1);
struct MovieData md2 = {"Child's Play","Tom Holland",1988,87};
display(md2);
return 0;
}

Output:

Title of Movie : Jurrassic Park
Director of Movie : Steven Spielberg
Releasing Year : 1993
Running time : 127 minutes
Title of Movie : Child's Play
Director of Movie : Tom Holland
Releasing Year : 1988
Running time : 87 minutes

Do ask if any doubt. Please upvote.