When printing to the terminal, the OR operator is not being applied in C++.
#include <iostream>
int main()
{
std::cout << false || true;
return 0;
}
Shift operators have higher priority than logical operators.
So this statement
std::cout << false || true;
is equivalent to
( std::cout << false ) || ( true );
As a result the literal false
will be outputted as integer 0
.
If you want to output the literal true
then you should write
std::cout << ( false || true );