### Help with boolean

#include <iostream>
#include <cmath>

using namespace std;

int main()
{ string monthName[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
int month,day,year;
bool boolValue;
cout << "Enter numeric values for month, day, and year of the date> ";
cin >> month >> day >> year;
if (month<1 || month>12 || day<1 || day>31 || year<=1582 || month ==4 && day>30 || month ==6 && day>30 || month ==9 && day>30 || month ==11 && day>30)
{
cout << month << "/" << day << "/" << year << " is not a valid date";
}

else if (year % 400 ==0 || year % 4==0 && year % 100!=0)
{
cout << monthName[month-1] << " " << day << ", " << year << " is a date in a leap year.";
}

else
{
cout << monthName[month-1] << " " << day << ", " << year << " is a date in a non-leap year.";
}
return 0;

}

Need help with the month February for both leap and non leap years. My friend said to use a boolean value because that's what the teachers looking for.

"If
the value entered for the month is 2, the value for day must be in the
range [1,29] for leap years and [1,28] for non-leap years."
Topic archived. No new replies allowed.