#ifndef DATE_H #define DATE_H #include <iostream> using namespace std; const unsigned char daysInMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const char* monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; class Date { private: int d; int m; int y; unsigned long j; bool dayWithinMonth(int day, int month, int year) const; unsigned long jday(int day, int month, int year) const; void dmy(); public: Date(int day = 0, int month = 0, int year = 0); ~Date() {} int day() const { return d; } int month() const { return m; } int year() const { return y; } unsigned long julday() const { return j; } const char* monthname() const { return monthNames[m-1]; } long operator-(const Date& rhs) const { return j - rhs.j; } }; ostream& operator<<(ostream& ostr, const Date& d); bool leapYear(int year); #endif