//闰年与非闰年的判定
#include<iostream>
using namespace std;
int main()
{
int year;
cout << "please enter a year :";
cin >> year;
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)//判断是否为闰年
cout << year << " is ";
else
cout << year << " is not ";
cout << " a leap year" << endl;
system("pause");
return 0;
}
闰年与非闰年的判定算法
于 2022-01-08 19:22:17 首次发布