1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include "std_lib_facilities.h"
namespace Chrono
{
enum class Month
{
jan = 1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
};
class Year
{
static const int min = 1800;
static const int max = 2200;
public:
class Invalid{};
Year(int x);
int year() { return y; }
private:
int y;
};
class Date
{
public:
class Invalid{};
Date();
Date(Month m, int d, Year y);
void add_day(int n);
Month month() const { return m; }
int day() const { return d; }
Year year() const { return y; }
private:
Year y;
Month m;
int d;
};
int days_in_month(Month m, Year y);
bool is_date(Month m, int d, Year y);
bool leapyear(Year y);
ostream& operator<<(ostream& os, const Date& d);
}
|