不知道哪里出錯(cuò)了,求解
#include <stdio.h>
int main()
{
??? /* 定義需要計(jì)算的日期 */
??? int year = 2008;
??? int month = 7;
??? int day = 8;
??? int total=0;
??? switch(month)
??? {
??????? case 1:total+=31;
??????? case 2:
??????? if(year%4==0&&year%100==0&&year%400!=0)
??????? {total+=29;}
??????? else{
??????? total+=28;
??????? }
??????? case 3:total+=31;
??????? case 4:total+=30;
??????? case 5:total+=31;
??????? case 6:total+=30;
??????? case 7:total+=31;
??????? case 8:total+=31;
??????? case 9:total+=30;
??????? case 10:total+=31;
??????? case 11:total+=30;
??????? case 12:total+=31;
??? }
???? total=total+day+1;
???? printf("%d年%d月%d日是該年的%d天",year,month,day,total);
?
?return 0;
}
請問哪里出了問題
2018-08-25
最后輸出的total為什么要在加一個(gè)1呢
2018-08-24
閏年判斷錯(cuò)了
if(year%400==0||year%100!=0&&year%4==0)