计算闰年代码

来源:互联网 发布:mac上的视频播放软件 编辑:程序博客网 时间:2024/05/02 02:55

#include <iostream>
using namespace std;
bool prime;
int main()
{
 int f(int);
 int year;
 cin>>year;
 if(year==1)
  cout<<year<<"是闰年"<<endl;
 else
  cout<<year<<"不是闰年"<<endl;
}
int f(int a)
{
 if(a%4==0)
 {
  if(a%100==0)
  {
   if(a%400==0)
    return(true);
   else
    return(false);
  }
  else
   return(true);
 }
 else
  return(false);
}

 

原创粉丝点击