|
|
|
|
|
|
|
July, August, September, October, November,
December
};
cout << monthString[mo1] < < day < , < yr;
}
//******************************************************************
RelationType DateType::ComparedTo(
/* in */ DateType otherDate ) const
// Postcondition:
// Function value == BEFORE, if this date is
// before otherDate
// == SAME, if this date equals otherDate
// == AFTER, if this date is
// after otherDate
{
if (yr < otherDate.yr) // Compare years
return BEFORE;
if (yr > otherDate.yr)
return AFTER;
if (mo < otherDate.mo) // Years are equal. Compare
return BEFORE; // months
if (mo > otherDate.mo)
return AFTER;
if (day < otherDate.day) // Years and months are equal.
return BEFORE; // Compare days
if (day > otherDate.day)
return AFTER;
return SAME; // Years, months, and days
} // are equal
//******************************************************************
void DateType::Increment()
// Postcondition:
// Date has been advanced by one day
{
|
|
|
|
|
|