I'm in a computer programming class and having trouble. The assignment is:
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.
I created my program, but getting errors. I guess I don't know exactly what they are asking for. Thanks for any help you can give.
#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:\n";
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:\n";
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;
}