#include <stdio.h>int main()?{???? /* 定義需要計(jì)算的日期 */??? int year = 2008;??? int month = 8;??? int day = 8;??? /*???? * 請(qǐng)使用swtich語句,if...else語句完成本題???? * 如有想看小編思路的,可以點(diǎn)擊左側(cè)任務(wù)中的“不會(huì)了怎么辦”???? * 小編還是希望大家獨(dú)立完成哦~???? */??? int date = 0;??? switch (month)??? {??????? case 12:??? date += 30;??????? case 11:??? date += 31;??????? case 10:??? date += 30;??????? case 9:??? date += 31;??????? case 8:??? date += 31;??????? case 7:??? date += 30;??????? case 6:??? date += 31;??????? case 5:??? date += 30;??????? case 4:??? date += 31;??????? case 3:??? if(year%400 != 0 && year%4 == 0){??????????????????????? date += 29;??????????????????? }else{??????????????????????? date += 28;}??????? case 2:??? date += 31;??????? default:??? date += 8,printf("2008年8月8日是該年的第%d天",date);break;??? }?return 0;}
- 1 回答
- 0 關(guān)注
- 1722 瀏覽
添加回答
舉報(bào)
0/150
提交
取消