How does it decide whether the statement is true or not?
The boolean operators follow the rules of boolean algebra.
The !
operator (not) corresponds to logical negation. Result is false if operand is true and true if operand is false.
The ||
(inclusive or) operator corresponds to logical (inclusive) disjunction. The result is false only if both operands are false. Otherwise result is true.
The output is 1, because the standard output stream produces the character 1 when you insert a true bool (unless the std::ios_base::boolalpha
format flag is set).