gpt4 book ai didi

c++ - if(x==y==z) 有效,if(x!=y!=z) 无效

转载 作者:行者123 更新时间:2023-11-30 19:53:04 24 4
gpt4 key购买 nike

为什么是:

if(x!=y!=z)

处理为:

x=1
y=1
z=2

??

我今天才注意到。

最佳答案

x != yx == y 返回 bool 值。
您正在将 z 与这些 bool 值进行比较。

它们都不会按照您希望的方式工作。

关于c++ - if(x==y==z) 有效,if(x!=y!=z) 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8287678/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com