C++ 布尔表达式的值是多少

C++ 布尔表达式的值是多少,c++,boolean,C++,Boolean,考虑下面的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 bool p=false,q=false,r=true; bool-other=p&q; 不能使用括号强制编译器按照您的需要计

考虑下面的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
bool p=false,q=false,r=true;
bool-other=p&q;

不能使用括号强制编译器按照您的需要计算内容。这里不会发生这种情况。相关搜索词:“运算符优先级”。奇怪。但是,为什么甚至需要显示一个单独的操作员才能将其放入brackets@Curious我刚才说的原因是:运算符优先。你查过了吗?cout@hkg328是的,这是OP想要的,但这是编译器读的。
(cout << another) || r;