JOKER3212196
2020-02-14 00:19
#include <stdio.h>
int main()
{
int year = 2020;
int month = 1;
int day = 31;
int sum;
switch(month)
{
case 1: sum=day; break;
case 2: sum=31+day; break;
case 3: sum=31+28+day; break;
case 4: sum=31+28+31+day; break;
case 5: sum=31+28+31+30+day; break;
case 6: sum=31+28+31+30+31+day; break;
case 7: sum=31+28+31+30+31+30+day; break;
case 8: sum=31+28+31+30+31+30+31+day; break;
case 9: sum=31+28+31+30+31+30+31+31+day; break;
case 10:sum=31+28+31+30+31+30+31+31+30+day; break;
case 11:sum=31+28+31+30+31+30+31+31+30+31+day; break;
case 12:sum=31+28+31+30+31+30+31+31+30+31+30+day; break;
default:printf("一年当中只有12个月份哦"); break;
}
if(year%400==0||year%4==0&&year%100!=0)
{
sum++;
printf("%d年是闰年\n",year);
printf("%d年%d月%d日是该年的第%d天",year,month,day,sum);
}
else
{
printf("%d年是平年\n",year);
printf("%d年%d月%d日是该年的第%d天",year,month,day,sum);
}
return 0;
}
输错了,是mouth>2
可以设置一个
if(mouth>0)
{
date++
}
之类的吗?(萌新弱弱的问)
一月10号肯定是一年的第10天啊
C语言入门
926210 学习 · 20797 问题
相似问题