Replaced nested if statement with boolean logic expression
This commit is contained in:
14
src/Date.cpp
14
src/Date.cpp
@@ -303,15 +303,11 @@ bool Date::leapYear (int year)
|
|||||||
{
|
{
|
||||||
bool ly = false;
|
bool ly = false;
|
||||||
|
|
||||||
if (!(year % 4))
|
// (year % 4 == 0) && (year % 100 !=0) OR
|
||||||
{
|
// (year % 400 == 0)
|
||||||
ly = true;
|
// are leapyears
|
||||||
if (!(year % 100))
|
|
||||||
{
|
if (((!(year % 4)) && (year % 100)) || (!(year % 400))) ly = true;
|
||||||
ly = false;
|
|
||||||
if (!(year % 400)) ly =true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ly;
|
return ly;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user