Pure Programmer
Blue Matrix

Cluster Map

Project: Leap Year Determination

Write a program to determine if a given calendar year is a [[leap year]]. Leap years are generally those that are evenly divided by 4. There is an exception, however, for years that are evenly divisible by 100 but not by 400. Test with the values 2016 (a leap year), 2015 (not a leap year), 2000 (a leap year), 1900 (not a leap year). You should write a function isLeapYear() that takes a year argument and returns true or false.

$ g++ -std=c++17 LeapYear2.cpp -o LeapYear2 -lfmt $ ./LeapYear2 1900 is NOT a leap year. 2000 is a leap year. 2012 is a leap year. 2019 is NOT a leap year.