In case you're wondering why what you did first behaved strangely: C++ treats any non-zero number as true, and zero as false. An assignment statement in C++ (like x=100) returns the value assigned, which is 100. You then effectively have an if statement that is like this:
Since 100 is non-zero, it is evaluated as true. Because you have hard-coded the value being assigned, your if statement will always evaluate to true, and never touch the else block. If you had a zero instead of a 100, you would always go straight to the else block.
The revised if statement does a comparison rather than an assignment, and it simply returns true or false.