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

Need help ASAP! C++ language only please. Write a program that uses a structure

ID: 3568192 • Letter: N

Question

Need help ASAP! C++ language only please.

Write a program that uses a structure named MovieData to store the following information about a movie:

Title
Director
Year Released
Running Time (in minutes)

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.

Write a function

    void displayMovieData(MovieData md);


to display information about the movie in a clearly formatted manner.(I will show you example program output)

The program should be in C++ language.

Here is an example input :

Here is the program output:

Here is the code for the program output above:

Please update the code so it follows the directions typed at the very top.

Write your code so the output is similar to the one above please.

Do not ask for user input/ do not cout a question. Just like the above output.

Also please post your program output. Thank you very much!!

Program Output
  List of movies by title                                    Psycho         Alfred Hitchcock 1960 109                          Schindler's List         Steven Spielberg 1993 195                             The Godfather     Francis Ford Coppola 1972 175                  The Shawshank Redemption           Frank Darabont 1994 142                                   Vertigo         Alfred Hitchcock 1958 128    List of movies by director                                    Psycho         Alfred Hitchcock 1960 109                                   Vertigo         Alfred Hitchcock 1958 128                             The Godfather     Francis Ford Coppola 1972 175                  The Shawshank Redemption           Frank Darabont 1994 142                          Schindler's List         Steven Spielberg 1993 195    List of movies by year released                                   Vertigo         Alfred Hitchcock 1958 128                                    Psycho         Alfred Hitchcock 1960 109                             The Godfather     Francis Ford Coppola 1972 175                          Schindler's List         Steven Spielberg 1993 195                  The Shawshank Redemption           Frank Darabont 1994 142    List of movies by running time                                    Psycho         Alfred Hitchcock 1960 109                                   Vertigo         Alfred Hitchcock 1958 128                  The Shawshank Redemption           Frank Darabont 1994 142                             The Godfather     Francis Ford Coppola 1972 175                          Schindler's List         Steven Spielberg 1993 195  

Explanation / Answer

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

const int SIZE = 50;

struct MovieData
{
char title[SIZE];
char director[SIZE];
int year;
int minutesRunning;
};

void GetMovieInfo(MovieData&);
void MovieDisplay(MovieData);

int main()
{
MovieData member1, member2;

GetMovieInfo(member1, member2);
MovieDisplay(member1, member2);
return 0;
}

void GetMovieInfo(MovieData &m1, &m2)
{
//Get movie title
cout << "Enter the title of the movie: ";
cin.ignore();
cin.getline(m1.title, SIZE);

//Get director's name
cout << "Enter the Director's name of the movie: ";
cin.ignore();
cin.getline(m1.director, SIZE);

//Get the release year
cout << "Enter the year the movie was released: ";
cin >> m1.year;

//Get the movie runtime in minutes
cout << "Enter runtime of the movie in minutes: ";
cin >> m1.minutesRunning;

//Get movie title
cout << "Enter the title of the movie: ";
cin.ignore();
cin.getline(m2.title, SIZE);

//Get director's name
cout << "Enter the Director's name of the movie: ";
cin.ignore();
cin.getline(m2.director, SIZE);

//Get the release year
cout << "Enter the year the movie was released: ";
cin >> m2.year;

//Get the movie runtime in minutes
cout << "Enter runtime of the movie in minutes: ";
cin >> m2.minutesRunning;
}

void MovieDisplay(MovieData m1, m2)
{
//Display the movie information
cout << "Below is the data of the desired movie: ";
cout << "Movie Title: " << m1.title << endl;
cout << "Director's Name: " << m1.director << endl;
cout << "Release Year: " << m1.year << endl;
cout << "Movie Runtime in minutes: " << m1.minutesRunning << endl;

//Display the movie information
cout << "Below is the data of the desired movie: ";
cout << "Movie Title: " << m2.title << endl;
cout << "Director's Name: " << m2.director << endl;
cout << "Release Year: " << m2.year << endl;
cout << "Movie Runtime in minutes: " << m2.minutesRunning << endl;

}   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote