多少天

#include
using namespace std;
int main()
{
int year,month,day;
int t=0;
cin>>year>>month;
if(year%400==0||(year%100!=0&&year%4==0))
t=1;
if(t==1)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if (month==2)
cout<<"29"<<endl;
}
    if(t==0)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if (month==2)
cout<<"28"<<endl;
}
return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章