【问题标题】:what's the object's type in Relationship between operation?操作关系中对象的类型是什么?
【发布时间】:2015-05-20 17:39:19
【问题描述】:

我阅读了 c++ 入门书,我发现了一个这样的例子:

int i = 1, j = 2, k = 3;

if(i < j < k)
    return 0;

我们都知道运算结果的类型是bool,所以“i

【问题讨论】:

标签: c++


【解决方案1】:

是的,i &lt; j 中的 true 将隐式转换为 1。然后1 &lt; k 也会产生true

false 将转换为 0

【讨论】:

    猜你喜欢
    • 2015-09-03
    • 1970-01-01
    • 2011-10-26
    • 2011-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多