编写函数,判断year是否为闰年,若是则返回1,否则返回0

来源:互联网 发布:matlab软件介绍 编辑:程序博客网 时间:2024/05/16 17:35
#include <iostream>
using namespace std;
int hhh(int year)
{
int x;
if (year % 100 != 0 && year % 4 == 0 || year % 100 == 0 && year % 400 != 0)
x = 1;
else x = 0;
return x;
}
void main()
{
int a;
cin >> a;
cout << hhh(a);


}
阅读全文
0 0
原创粉丝点击