//Devin Scheu CS1A Chapter 11, P. 645, #1
//
/**************************************************************
*
* DISPLAY MOVIE INFORMATION
* ____________________________________________________________
* This program displays information about two movies using
* a structure.
* ____________________________________________________________
* INPUT
* movie1 : The data for the first movie
* movie2 : The data for the second movie
*
* OUTPUT
* movieDetails : The formatted display of movie information
*
**************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct MovieData {
string title;
string director;
int yearReleased;
int runningTime;
};
// Function to display movie information
void displayMovie(const MovieData& movie) {
cout << left << setw(25) << "Title:" << right << movie.title << endl;
cout << left << setw(25) << "Director:" << right << movie.director << endl;
cout << left << setw(25) << "Year Released:" << right << movie.yearReleased << endl;
cout << left << setw(25) << "Running Time:" << right << movie.runningTime << " minutes" << endl;
cout << endl;
}
int main () {
//Variable Declarations
MovieData movie1; //INPUT - The data for the first movie
MovieData movie2; //INPUT - The data for the second movie
string movieDetails; //OUTPUT - The formatted display of movie information
//Initialize Movie 1
movie1.title = "The Shawshank Redemption";
movie1.director = "Frank Darabont";
movie1.yearReleased = 1994;
movie1.runningTime = 142;
//Initialize Movie 2
movie2.title = "Inception";
movie2.director = "Christopher Nolan";
movie2.yearReleased = 2010;
movie2.runningTime = 148;
//Separator and Output Section
cout << "-------------------------------------------------------" << endl;
cout << "OUTPUT:" << endl;
//Display Movie Information
cout << "Movie 1 Details:" << endl;
displayMovie(movie1);
cout << "Movie 2 Details:" << endl;
displayMovie(movie2);
} //end of main()