请考虑以下 c++ 代码
bool p = false, q = false, r = true;
bool another = p && q;
cout << another; // another =false now
cout << another || r; //false || true should be true
编译器输出为 0(假(,但如何。我希望它是 1(真(
谢谢
<<
运算符的优先级高于||
,因此编译器将其解释为
(cout << another) || r;