求助,第二个数据一直报错
查看原帖
求助,第二个数据一直报错
1186905
djrichergun楼主2023/11/17 16:43

#include using namespace std;

int main()
{
   int year,month;
   cin>>year>>month;
   if(year%4!=0||(year%4==0&&year%100==0))
   {
       if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
       {
           cout<<31<<endl;
       }
       else if(month==4||month==6||month==9||month==11)
       {
           cout<<30<<endl;
       }
       else if(month==2)
       {
           cout<<28<<endl;
       }
   }
   else if(year%400==0||(year%4==0&&year%100!=0))
   {
       if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
       {
           cout<<31<<endl;
       }
       else if(month==4||month==6||month==9||month==11)
       {
           cout<<30<<endl;
       }
       else if(month==2)
       {
           cout<<29<<endl;
       }
   }
   return 0;
}
2023/11/17 16:43
加载中...