测试闰年的算法:
算法1:
int year;
cin >> year;
if(year % 4 != 0)
cout << "不是闰年";
else if (year % 100 != 0)
cout << "是闰年";
if(year % 400 != 0)
cout << "不是闰年";
算法2:
int year;
cin >> year;
if(year % 4 == 0 && year % 100 != 0)
cout << "是闰年";
else if(year % 400 == 0)
cout << "是闰年";
else
cout << "不是闰年";