Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#define SENTINEL -9999#define BLANK -9999typedef struct {int year, month, day;int hour, minute, second;} DateTime;// void printDateTime(const DateTime &d) {// std::cout << d.year << "-" << d.month << "-" << d.day// << " " << d.hour << ":" << d.minute << ":" << d.second << std::endl;// }bool isLeapYear(int year) {return (year%4 == 0 && year%100 != 0) || (year%400 == 0);}int yearsJunLeapSec[] = {1972, 1981, 1982, 1983, 1985, 1992, 1993, 1994, 1997, 2012, 2015, SENTINEL};int yearsDecLeapSec[] = {1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1987, 1989, 1990, 1995, 1998, 2005, 2008, 2016, SENTINEL};int daysOfMonthNonLeap[13]={BLANK, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int daysOfMonthLeap[13]={BLANK, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};bool isLeapSec (int year, int leapSecArr[]) {for(int i = 0, y = leapSecArr[0]; y != SENTINEL; y = leapSecArr[++i]) {if(year == y) {return true;}}