Ad

january = 1
december = 12

on leap year, february has 29 days, 28 otherwise

int nbDaysInMonth(int month, bool leap)
{
    return 31 - (month % 2 == (month > 7)) - (month == 2) * (2 - leap);
}