#include <iostream>
using namespace std;
int main()
{
int year;
bool leap;
cout<<"please enter year:";
cin>>year;
if (year%4==0)
{if(year%100==0)
{if (year%400==0)
leap=true;
else leap=false;}//(year%400==0||(year%4==0&&year%100!=0))
else
leap=true;}
else
leap=false;
if (leap)
cout<<year<<" is ";
else
cout<<year<<" is not ";
cout<<" a leap year."<<endl;
system("pause");
return 0;
}
例题3-8
最新推荐文章于 2021-11-29 11:18:54 发布