The problem looks to me that its not actually caused by the daysInMonth+1 as being a requirement, rather that daysInMonth is incorrect. Of course the daysInMonth + 1 would be invalid for something like april 31, which will check out as fine here. So you should just be checking for <= daysInMonth as you have assumed and that's correct.
Here's the problem:
Code:
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12);
daysInMonth = 31;
if (month == 4 || month ==6 || month == 9 || month == 11);
daysInMonth = 30;
With the exception of february since it overwrites (although will still assign here as well), EVERY month is assigned daysInMonth = 30. That's caused by this:
Code:
if (month == 4 || month ==6 || month == 9 || month == 11);
^
A semi-colon at the end of any control structure such as an if or a loop is true once and only once (and for the last option if its an iteration). So no matter what the month, even a month of -1, the daysInMonth will be 30 here, and the only exception is the 2nd month which then overwrites.
I'd recommend the use of braced evaluations as well as using elseif (since it can only be one of these possible options) or a switch.