(C++)实现日期类
运算符操作如下
+=
//+=
Date& Date::operator+=(int day)
{
_day += day;
//天数不合法,进位
while (_day > GetMonthDay(_year, _month))
{
_day -= GetMonthDay(_year, _month);
_month++;
if (_month > 12)
{
++_year;
_month = 1;
}
}
return *this;
原创
2021-10-25 19:09:13 ·
215 阅读 ·
5 评论