#include <iostream>
usingnamespace std;
bool isLeapYear(int year);
int main() {
int year = 0;
cout << "Enter a year: ";
cin >> year;
if (isLeapYear(year))
cout << "This year is a leap year.\n";
else
cout << "This year is not a leap year.\n";
return 0;
}
bool isLeapYear(int year) {
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
#include <iostream>
bool isLeapYear(int);
int main()
{
int year;
std::cout << "Enter the year: ";
std::cin >> year;
bool leapYear = isLeapYear(year);
}
bool isLeapYear(int year)
{
if (year % 4 == 0)
{
if (year % 100 == 0)
{
if (year % 400 == 0)
{
std::cout << "This year is a leap year.\n";
returntrue;
}
else
{
std::cout << "This year is not a leap year.\n";
returnfalse;
}
}
else
{
std::cout << "This year is not a leap year.\n";
returnfalse;
}
}
else
{
std::cout << "This year is not a leap year.\n";
returnfalse;
}
returnfalse;
}