if(t%100==0 && t%400!=0) cout<<"a normal year"<<endl;
else if(t%400==0) cout<<"a leap year"<<endl;
else if(t%4==0) cout<<"a leap year"<<endl;
else cout<<"a normal year"<<endl;
if(t%100==0 && t%400!=0) cout<<"a normal year"< else if(t%400==0) cout<<"a leap year"< else if(t%4==0) cout<<"a leap year"< else cout<<"a normal year"<
中間兩個else if似乎可以合併簡化如下:
if(y%400 != 0 && y%100 == 0)
cout<< "a normal year";
else if(y%4 == 0)
cout << "a leap year";
else
cout << "a normal year";