可以在C ++中比较两个布尔值吗? [英] Can two booleans be compared in C++?
本文介绍了可以在C ++中比较两个布尔值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码应该起作用吗?
Is the following piece of code supposed to work?
bool b1 = true;
bool b2 = 1 < 2;
if (b1 == b2)
{
// do something
}
我怀疑不是所有的真"都相等.
I suspect that not all 'trues' are equal.
推荐答案
是.所有真理都是平等的.
Yes. All trues are equal.
这篇关于可以在C ++中比较两个布尔值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文