【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了Leap.cpp相关资料,希望对各位网友有所帮助!
// Leap.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
bool IsLeap(const int year)
{
bool ret = false;
if (year % 4 ==0)
if (year % 100 == 0)
{
if (year % 400 == 0)
ret = true;
}
else
{
ret = true;
}
return ret;
}
int main(int argc, char* argv[])
{
int year = 2000;
if (IsLeap(year))
printf("%d年是闰年\n",year);
else
printf("%d年不是闰年\n",year);
return 0;
}