-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.h
40 lines (35 loc) · 846 Bytes
/
date.h
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
//
// date.hpp
// date
//
// Created by Kyra Thompson on 7/20/18.
// Copyright © 2018 Kyra Thompson. All rights reserved.
//
#ifndef date_h
#define date_h
#include <stdio.h>
enum class Month {
jan = 1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
};
class Date {
public:
class Invalid{};
Date();
Date(int yy, Month mm , int dd);
void add_day(int n);
void add_month(int n);
void add_year(int n);
int month() const {return int(m);}
int year() const { return y;}
int day() const { return d;}
bool isvalid();
private:
int y, d;
Month m;
};
ostream& operator<<(ostream& os, const Date& d);
istream& operator << (istream& is, Date& d);
bool operator==(const Date& d, const Date& d2);
bool operator!=(const Date& d, const Date& d2);
bool leapyear(const int& y);
#endif /* date_h */