End of Job

I am new to programming and C++ I am taking a principles of programming class and also new to this forum. My lab question was to take this program and determine valid dates and invalid dates by input by user my out put in my end of job function should be month/day/year/ us a valid date or month/day/year is an invalid date. Here is my code and I am not sure why my program just terminates and does not output, you can see I have been trying different things by my commented out code. Any direction would be appreciated.

/* Program Name: BadDate.cpp
Function: This program determines if a date entered by the user is valid.
Input: Interactive
Output: Valid date is printed or user is alerted that an invalid date was entered
*/

#include <iostream>
bool validateDate(int, int, int);
using namespace std;
int main()
{
// Declare variables

int year;
int month;
int day;
const int MIN_YEAR = 0, MIN_MONTH = 1, MAX_MONTH = 12, MIN_DAY = 1, MAX_DAY = 31;
bool validDate = true;

// This is the work of the housekeeping() method
// Get the year, then the month, then the day
cout << "Enter year: ";
cin >> year;
cout << "Enter month: ";
cin >> month;
cout << "Enter day: ";
cin >> day;



// This is the work of the detailLoop() method
// Check to be sure date is valid


if(year <= MIN_YEAR) // invalid year
validDate = false;
else if (month < MIN_MONTH || month > MAX_MONTH) // invalid month
validDate = false;
else if (day < MIN_DAY || day > MAX_DAY) // invalid day
validDate = false;

// This is the work of the endOfJob() method
// test to see if date is valid and output date and whether it is valid or not
if(validDate == true)
{
// Output statement
cout << month << day << year;



}
else
{
// Output statement
//cout << month << "/" << day << "/" << year "is an invalid date.";

return 0;

}

} // end of main() function
Change the line
//cout << month << "/" << day << "/" << year "is an invalid date.";
To this
cout << month << "/" << day << "/" << year << "is an invalid date.";

You just forgot the << operator
Thank you so much I was so discouraged today! So much to remember.
Topic archived. No new replies allowed.