So I have to code a program that will output how many days are in the month not excluding leaper year. I have placed the code below, and I unable to find the error, I am getting an error of "expression must be a modifiable lvalue". Any help would be appreciated.
The error message should give you the number of the line on which the error occurs.
I can't immediately spot where that particular error is. I'm guessing it might have something to do with the way precedences are resolved in line 21, but I may be wrong. If you use more parentheses to enforce the precedence that you actually intend, then it might fix the problem. But, as I say, I'm just guessing.
I've noticed some other problems with your code:
At line 16, the month = 11 clause is, presumably, a typo for month == 11. This will cause that if condition to always evaluate to true, regardless of the initial value of month.
At line 19, using a leading in 02 instructs the compiler to consider this an octal value, rather than a decimal one. In this case, it doesn't cause a problem, as 2 in octal is the same as 2 in decimal, but it's worth taking care over it.
At line 23, it would be more idiomatic to compare a bool variable to true or false:
if (leapyear == false)
but most programmers would find the following even more idiomatic:
if (!leapyear)
Presumably line 24 is intended to be setting the number of days to 28, not 29?
EDIT: It's normal to have main return 0 for success, and a non-zero code for failure. Did you intend to write the number of days out to the standard output, rather than returning it?