慕莱坞6193952
2019-02-24 20:08
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int f=0;
int s=0;
if ((year%4==0&&year%100!=0)||(year%400==0))
{
f=29;
}
else
{
f=28;
}
switch(month)
{
case 1:
s=day;
break;
case 2:
s=31+day;
break;
case 3:
s=31+f+day;
break;
case 4:
s=31+f+31+day;
break;
case 5:
s=31+f+31+30+day;
break;
case 6:
s=31+f+31+30+31+day;
break;
case 7:
s=31+f+31+30+31+30+day;
break;
case 8:
s=31+f+31+30+31+30+31+day;
break;
case 9:
s=31+f+31+30+31+30+31+31+day;
break;
case 10:
s=31+f+31+30+31+30+31+31+30+day;
break;
case 11:
s=31+f+31+30+31+30+31+31+30+31+day;
break;
case 12:
s=31+f+31+30+31+30+31+31+30+31+30+day;
break;
}
printf("这天是这一年中的第%d天",s);
中文逗号:,
英文逗号:,
C语言入门
926217 学习 · 20797 问题
相似问题