蓝桥杯C++语言A1301高斯日记使用时间函数高效解决
发布时间
阅读量:
阅读量
先给出<time.h>编程解法
#include <iostream>
#include <time.h>
#include <iomanip>
// Suppose Gauss was born in 1777-04-30,
// and that day was denoted as 1 by him.
// For example, the relative day of 1791-12-15
// was represented as 5343.
//
// What is the absolute day of 8113?
// Answer: 1799-07-16
struct tm start = {
.tm_sec=0,
.tm_min=0,
.tm_hour=0,
.tm_mday=30,
.tm_mon=4-1,
.tm_year=1777+400-1900,
};
start.tm_mday+=8113;
time_t start_all=mktime(&start);
tm * start_tmp=gmtime(&s
全部评论 (0)
还没有任何评论哟~
