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
|
//DATE.H FILE
#include <iostream>
#include <string>
using namespace std;
enum DateFormat {numeric, standard, alternative};
const int MIN_YEAR = 1900;
const int MAX_YEAR = 2015;
const string monthStr [] =
{"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November",
"December"};
const int monthDays [] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
class Date
{
private:
int month;
int year;
int day;
bool IsValidDate();
public:
Date(int m, int d, int y)
{
if (!IsValidDate())
{
month = 1;
day = 1;
year = 2001;
}
month = m;
year = y;
day = d;
}
void Print(DateFormat format);
};
|