标签:c++ isl iso int end ota auto clu 函数
#ifndef LEAPYEAR_INCLUDED
#define LEAPYEAR_INCLUDED
class LeapYear
{
public:
bool IsLeapYear(int year);
};
#endif
#include "leapyear.hpp"
auto Or = [](bool a,bool b)->bool{ return a||b; };
auto And = [](bool a,bool b)->bool{ return a&&b; };
auto Not = [](bool a)->bool{ return !a; };
auto Aliquot = [](int dividend,int divisor){return dividend%divisor == 0;};
bool LeapYear::IsLeapYear(int year)
{
auto aliquotby4 = Aliquot(year,4);
auto notaliquotby100 = Not(Aliquot(year,100));
auto aliquotby400 = Aliquot(year,400);
auto leapyear = Or(And(aliquotby4,notaliquotby100),aliquotby400);
return leapyear;
}
标签:c++ isl iso int end ota auto clu 函数
原文地址:http://www.cnblogs.com/atoman/p/7413743.html