文章
33
粉丝
78
获赞
3
访问
19.1k
#include <stdio.h>
struct date {
int year;
int month;
int day;
}p, q;
int main() {
int year, month, day;
int f[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int pre = 0, post = 0;
int gap = 0;
scanf("%4d%02d%02d", &p.year, &p.month, &p.day);
scanf("%4d%02d%02d", &q.year, &q.month, &q.day);
//same year
if (p.year == q.year) {
if ((p.year % 4 == 0 && p.year % 100 != 0) || p.year % 400 == 0)
f[2] = 29;
for (int i = 0;i < p.month;i++)
pre += f[i];
pre += p.day;
&n...
登录后发布评论
暂无评论,来抢沙发