vsgdp <he***@null.comwrote:
bool a =false;
bool b=true;
cout << (a || b) && false;
cout.operator <<((a || b) && false);
The first cout outputs true. The second one false. Why not both false?
Order of operations. The first one does "cout << (a || b)" first, which
returns a reference to the stream (cout). Then it does "cout && false"
and discards the result.
It should do what you think if you add an extra set of parentheses:
cout << ((a || b) && false);
--
Marcus Kwok
Replace 'invalid' with 'net' to reply