#include <date.h>
Public Member Functions | |
Date () | |
Date (int mm, int dd, int yy) | |
void | setDate (int mm, int dd, int yy) |
void | input (istream &in) |
void | output (ostream &out) const |
bool | before (const Date &date) const |
bool | equal (const Date &date) const |
bool | after (const Date &date) const |
Private Attributes | |
int | mm |
int | dd |
int | yy |
Friends | |
ostream & | operator<< (ostream &out, const Date &date) |
istream & | operator>> (istream &in, Date &date) |
Date::Date | ( | ) |
Default constructor. Sets a defalt object to "01/01/2000".
Date::Date | ( | int | mm, | |
int | dd, | |||
int | yy | |||
) |
Explicit constructor. Sets the date to the specified values.
mm | the month, an int value in [1, 12] | |
dd | the day, an int value in [1, 28, 30, 31], depending on the month | |
yy | the year, an int value greater than or equal to 0 |
void Date::setDate | ( | int | mm, | |
int | dd, | |||
int | yy | |||
) |
Sets this Date object. Fails silently by not setting values that are out of range.
mm | the month, an int value in [1, 12] | |
dd | the day, an int value in [1, 28, 30, 31], depending on the month | |
yy | the year, an int value greater than or equal to 0 |
void Date::input | ( | istream & | in | ) |
Inputs or reads a Date object in the format "MM/DD/YYYY" from the input stream. Sets the fail bit of the input stream if the object is improperly formatted.
in | the input stream for reading |
void Date::output | ( | ostream & | out | ) | const |
Ouputs this Date object in the format "MM/DD/YYYY" to the specified output stream with an end-of-line character.
out | the output stream |
bool Date::before | ( | const Date & | date | ) | const |
Returns true if this date is before the specified date; returns false otherwise.
date | the specified date |
bool Date::equal | ( | const Date & | date | ) | const |
Returns true if this date is equal to the specified date; returns false otherwise.
date | the specified date |
bool Date::after | ( | const Date & | date | ) | const |
Returns true if this date is after the specified date; returns false otherwise.
date | the specified date |
ostream& operator<< | ( | ostream & | out, | |
const Date & | date | |||
) | [friend] |
istream& operator>> | ( | istream & | in, | |
Date & | date | |||
) | [friend] |
int Date::mm [private] |
the month of the year
int Date::dd [private] |
the day of the month
int Date::yy [private] |
the year