cout << "Please enter the Title of a movie." << endl;
getline(cin,Title);
cout << "Please enter the Director's name." << endl;
getline(cin,Director);
cout << "Please enter the year it was released." << endl;
cin >> Year;
//Checks to see if the year is valid
if(Year >= 1900 && Year <= 2004);
else {
Year = 0;
cout << "Please enter a number between 1900 and 2004." << endl;
return false;
}
cout << "Please enter the amount of minutes the movie takes." << endl;
cin >> Time;
//checks to see if the minute is correct
if (Time >= 0 && Time <= 14400);
else if(Time < 0) {
Time = 0;
cout << "Please enter a positive number, time cannot be negative."
<< endl;
return false;
} else
return false;
//Sets the private members
movieInfo1.setTitle(Title);
movieInfo1.setDirector(Director);
movieInfo1.setYear(Year);
movieInfo1.setTime(Time);
//***************************~~SECOND~~*****************************************
//****************************~~MOVIE~~*****************************************
//
cout << "Please enter the Title of another movie." << endl;
getline(cin,Title);
cout << "Please enter the Director's name." << endl;
getline(cin,Director);
cout << "Please enter the year it was released." << endl;
cin >> Year;
//Checks to see if the year is valid
if(Year >= 1900 && Year <= 2004);
else {
Year = 0;
cout << "Please enter a number between 1900 and 2004." << endl;
return false;
}
cout << "Please enter the amount of minutes the movie takes." << endl;
cin >> Time;
//checks to see if the minute is correct
if (Time >= 0 && Time <= 14400);
else if(Time < 0) {
Time = 0;
cout << "Please enter a positive number, time cannot be negative."
<< endl;
return false;
} else
return false;
//Sets the private members
movieInfo2.setTitle(Title);
movieInfo2.setDirector(Director);
movieInfo2.setYear(Year);
movieInfo2.setTime(Time);
cout << "The title of the first Movie is: " << movieInfo1.getTitle()
<< endl;
cout << "The Director's name is: " << movieInfo1.getDirector() << endl;
cout << "The year it was released was: " << movieInfo1.getYear() << endl;
cout << "The amount of minute the movie lasted was: "
<< movieInfo1.getTime() << endl;
cout << "\nThe title of the second Movie is: " << movieInfo2.getTitle()
<< endl;
cout << "The Director's name is: " << movieInfo2.getDirector() << endl;
cout << "The year it was released was: " << movieInfo2.getYear() << endl;
cout << "The amount of minute the movie lasted was: "
<< movieInfo2.getTime() << endl;
return 0;
}//end main
When i run it, it skips
"cout << "Please enter the Title of another movie." << endl;
getline(cin,Title); "
and goes straight into
cout << "Please enter the Director's name." << endl;