大佬求助運(yùn)行成功輸出錯(cuò)誤
#include <stdio.h>
int main()?
{?
? ? int year = 2008;
? ? int month = 8;
? ? int day = 8;
? ? int date=0;
? ? switch(month)
? ? {
? ? ? ? case 2:date+=31;
? ? ? ? case 3:date+=28;
? ? ? ? case 4:date+=31;
? ? ? ? case 5:date+=30;
? ? ? ? case 6:date+=31;
? ? ? ? case 7:date+=30;
? ? ? ? case 8:date+=31;
? ? ? ? case 9:date+=31;
? ? ? ? case 10:date+=30;
? ? ? ? case 11:date+=31;
? ? ? ? case 12:date+=30;
? ? ? ? break;
? ? }
? ? date+=day;
? ? if(year%100!=0||year%400==0&&year%4==0)
? ? {
? ? ? ? if(month>2)
? ? ? ? {
? ? ? ? ? ? date++;
? ? ? ? }
? ? }
? ? printf("%d年%d月%d日是該年的第%d天",year,month,day,date);
return 0;
}
2020-03-19
date只是表示了每個(gè)月的第一天是這一年的第多少天啊。還得加上幾號(hào)的天數(shù)啊
2020-03-19
好像有date+=day
而且我差的好遠(yuǎn),才一百六十幾...