Originally posted by blight2c
my granddad always said, "if it's possible to skin a cat . . ."
I dont get it
Anyway to answer the question, here is a start. It checks that the number of days is appropriate for the month, however does not cater for leap years.
Code:
//uses a date object for simplicity
bool checkDate( const Date& date )
{
static int daysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if( date.day <= 0 || date.day > daysInMonth[ date.month -1 ] )
{
cout << "bad date, try again" << endl;
return false;
}
return true;
}