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). How many values do we need to test with to ensure that our code is correct? (Hint: Use the ternary conditional operator to insert the string " not" when it is not a leap year and "" when it is a leap year)

$ g++ -std=c++17 LeapYear1.cpp -o LeapYear1 -lfmt $ ./LeapYear1 1900 is NOT a leap year.