#include using namespace std; // illustrates user-defined function for determining leap years bool IsLeapYear(int year) // precondition: year > 0 // postcondition: returns true if year is a leap year, else returns false { if (year % 400 == 0) // divisible by 400 { return true; } else if (year % 100 == 0) // divisible by 100 { return false; } else if (year % 4 == 0) // divisible by 4 { return true; } return false; } int main() { int year; cout << "enter a year "; cin >> year; if (IsLeapYear(year)) { cout << year << " has 366 days, it is a leap year" << endl; } else { cout << year << " has 365 days, it is NOT a leap year" << endl; } return 0; }