解题思路:
注意事项:
参考代码:
#include <stdio.h>
struct date
{
int year;
int month;
int day;
};
int Nowday(struct date Date)
{
int sum = 0;
int i;
int a[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if((Date.year % 4 == 0 && Date.year % 100 != 0) || Date.year % 400 == 0)
{
a[1] = 29;
}
for(i = 0; i < Date.month - 1; i++)
{
sum += a[i];
}
sum += Date.day;
return sum;
}
int main()
{
struct date nowdate;
scanf("%d%d%d", &nowdate.year, &nowdate.month, &nowdate.day);
printf("%d", Nowday(nowdate));
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:711 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:529 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:594 |
【矩阵】 (C++代码)浏览:950 |
1012题解浏览:870 |
小O的图案 (C语言代码)浏览:915 |
众数问题 (C语言代码)浏览:630 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:406 |
C语言程序设计教程(第三版)课后习题9.1 (C语言代码)浏览:546 |
IP判断 (C++代码)浏览:754 |