newdate.cpp
来自「Since the field of object oriented progr」· C++ 代码 · 共 28 行
CPP
28 行
// Chapter 7 - Program 10 - NEWDATE.CPP
#include "newdate.h"
extern int days[];
// This routine ignores leap year for simplicity, and adds
// the days in each month for all months less than the
// current month, then adds the days in the current month
// up to today.
int new_date::get_day_of_year(void)
{
int index = 0;
day_of_year = 0;
while (index < month)
{
day_of_year += days[index++];
}
return (day_of_year += day);
}
// Result of execution
//
// (This file cannot be executed)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?