cdate.h

来自「使用tasking for mc683XX C编译器」· C头文件 代码 · 共 45 行

H
45
字号
//a date class declaration

class CDate {
  public:
	enum  {
  	  Invalid,
  	  January,
  	  February,
  	  March,
  	  April,
  	  May,
  	  June,
  	  July,
  	  August,
  	  September,
  	  October,
  	  November,
  	  December
  	};

	CDate(int d=1, int m=January, int y=1970);  // default date 1/1/1970
 	~CDate();
 	CDate(const CDate& rhs);
	CDate& operator=(const CDate& rhs);

	CDate operator++();					//pre inc
	CDate operator++(int);				//post inc
	bool  operator==(const CDate& rhs) const;

	void  Set(int d, int m, int y);

	bool  isLeapYear (void)    const;
	int   DayOfYear  (void)    const;
    int   daysInMonth(int mon) const;
	void  show		 (void)    const;

private:
	bool  isAlive(void) const;
  
  	int year;
	int month;
	int day;
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?