Sometimes, we can make the logic of if()… else… statements clearer by nesting if()… else… statements within either one or both clauses of the if()… else… statements.
In our isLeap() example, someone new to the intricacies of Gregorian calendar development and the subtleties of century leap year calculation might have to pause and wonder a bit about our if/else fall-through logic. Actually, this case is pretty simple; much more tangled examples of such a logic can be found. Nonetheless, we can make our logic a bit clearer by nesting an if … else … statement within one of theif()… else…clauses.
Copy leapYear2.c to leapYear3.c, which we will now modify. Our isLeap() function now looks like this:
bool isLeapYear( int year ) {
bool isLeap = false;
// Leap years not part of Gregorian calendar until after 1752.
//
if( year < 1751...