//Jonathan Estrada CSC5 Chapter 11, P.645, #1
/*******************************************************************************
* MOVIE INFORMATION
* _____________________________________________________________________________
* This program accepts information for a number of a movies title, director,
* year released, and run time. Then the information will be displayed
* properly formatted.
* _____________________________________________________________________________
* INPUT
* SIZE : Number of movies
* title : Movie title
* director : Director of movie
* yearRelease : Year released
* runTime : Movie Runtime
*
* ****************************************************************************/
#include <iostream>
#include <string>
using namespace std;
struct MovieData
{
string title;
string director;
int yearRelease;
float runTime;
};
int main()
{
int SIZE;
cout << "How how many movies do you want to enter information about: ";
cin >> SIZE;
cout << SIZE << endl << endl;
cin.ignore();
MovieData* movie = new MovieData[SIZE];
cout << "Please enter information for " << SIZE << " movie(s)." << endl;
for(int i = 0; i < SIZE; i++)
{
cout << "Title: ";
getline(cin, movie[i].title);
cout << "Direcetor: ";
getline(cin, movie[i].director);
cout << "Year Released: ";
cin >> movie[i].yearRelease;
cin.ignore();
cout << "Running TIme (in minutes): ";
cin >> movie[i].runTime;
cin.ignore();
cout << endl;
}
for(int i = 0; i < SIZE; i++)
{
cout << "Inforamation for movie " << (i+1) << endl;
cout << "Title: " << movie[i].title << endl;
cout << "Director: " << movie[i].director << endl;
cout << "Year Released: " << movie[i].yearRelease << endl;
cout << "Running TIme (in minutes): " << movie[i].runTime << endl;
}
delete[] movie;
return 0;
}