是闰年吗?
时间: 1ms 内存:128M
描述:
编写函数is_LeapYear实现其参数是否是闰年的判断,如果参数是闰年则返回true,如果不是闰年返回false。
在主函数输入年,调用函数is_LeapYear来进行判断是否是闰年,在main函数中输出结果。
在以下程序的基础上,添加is_LeapYear函数的定义,使程序能够正确执行,提交时,只需要提交is_LeapYear函数的定义代码即可。
#include <iostream>
using namespace std;
bool is_LeapYear(int m); //判断闰年函数的声明
int main()
{
int year;
cin>>year;
if(is_LeapYear(year))
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
return 0;
}
输入:
年份
输出:
闰年yes,非闰年no
示例输入:
2015
示例输出:
no
提示:
参考答案:
文章评论