📄 date.h
字号:
//=====================================
// date.h
// class Date derived from IDate
//=====================================
#include"idate.h"
#include<iostream>
//-------------------------------------
class Date : public IDate{
int year, month, day;
protected:
int ymd2i()const;
void i2ymd(int n);
static const int tians[];
bool isLeapYear()const{ return !(year%4)&&(year%100)||!(year%400); }
public:
Date(const std::string s);
Date(int n){ i2ymd(n); }
Date(int y, int m, int d):year(y),month(m),day(d){}
~Date(){}
Date& operator+(int n){ return *new Date(ymd2i()+n); }
Date& operator+=(int n){ i2ymd(ymd2i()+n); return *this; }
Date& operator++(){ return *this +=1; }
void print(std::ostream& o)const;
};//-----------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -