判断某一年是否是闰年
#include <iostream>
using namespace std
;
int main()
{
cout
<< "请输入要判断的年份:" << endl
;
int x
= 0;
cin
>> x
;
if (x
% 4 == 0 && x
% 100 != 0)
{
cout
<<x
<< "年为闰年!" << endl
;
}
else if (x
% 100 == 0 && x
% 400 == 0)
{
cout
<< x
<< "年为闰年!" << endl
;
}
else
{
cout
<< x
<< "年不是闰年!" << endl
;
}
system("pause");
return 0;
}
转载自:黑凤梨の博客
转载请注明原文地址:https://blackberry.8miu.com/read-2674.html