This code:
 if (year % 4 == 0  year % 100 != 0  year % 400 == 0)

{etc...
says that if the year is divisible by 4 OR the year is not divisible by 100 OR the year is divisible by 400, then the year is a leap year.
The way the compiler codes this is to stop evaluating the IF when the expression becomes true.
In this case any year divisible by 4 will be a valid leap year. So 2012 is a leap year.
Then look at 2011. Not divisible by 4 so the evaluation of the IF continues to OR the year not divisible by 100. 2011 is not divisible by 100 so it is also a leap year.
Not good.
You have to check the year this way:
1) is the year divisible by 4? If yes go to step 2. Otherwise, the year is not a leap year.
2) is the year from step 1 divisible by 100. If not, the year is a leap year. If divisible by 100, go to step 3.
3) Is the year from step 2 divisible by 400? If it is, the year is a leap year. Otherwise it is not.
Post again if you need more help.