C + + conditions about judging whether it is a leap year, Tan Haoqiang writing is:
1. Can be divided exactly by 4, but cannot be divided exactly by 100
2. Divisible by 100, and divisible by 400,
Why hasn't the book code below divisible by 100 this condition, and wrote a divisible by 400, only because divisible by 400 the number is divisible by 100 and omit? (though I have this condition and knocked again and found no problem)
There was the first time is to determine the leap year I wanted to is in the judgment is a leap year based on the expression of change==!=,!===, found out is wrong, then the problem is coming, why determine the leap year is below that of expressions
CodePudding user response:
Can't be divided exactly by 4 is not a leap year, can be divided exactly by 100 and can't be divided exactly by 400, not a leap year, any one, is not a leap yearCodePudding user response:
1 divisible by 100 cannot be divided exactly by 4 there is no2 in addition to what you have said!===,==instead!=, logical operators will change accordingly, such as & amp; & To | | to | | to & amp; &
CodePudding user response:
Thank you bosses to reassureCodePudding user response: