“a&lt; b&lt; C&QUOT;不同于“(a&lt; b)&amp;&amp; (b <c)“? [英] &quot;a &lt; b &lt; c&quot; not the same as &quot;(a &lt; b) &amp;&amp; (b &lt; c)&quot;?

查看:69
本文介绍了“a&lt; b&lt; C&QUOT;不同于“(a&lt; b)&amp;&amp; (b <c)“?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数学表达式中:


(a< b)&& (b< c)


将被描述为:


a< b< c


但是为什么在C中这两个表达式对a,b和c的相同值进行评估?

不同?


例如:


= a = 0,b = 3且c = 2:


a< b< c = 1

(a< b)&& (b< c)= 0

输入C时。

In math this expression:

(a < b) && (b < c)

would be described as:

a < b < c

But why is it that in C these two expressions evaluate to something
different for the same values of a, b and c?

e.g:

for a = 0, b = 3 and c = 2:

a < b < c = 1
(a < b) && (b < c) = 0

when typed in C.

推荐答案



" Paminu" < JA ****** @ asd.com>在消息中写道

news:di ********** @ news.net.uni-c.dk ...

"Paminu" <ja******@asd.com> wrote in message
news:di**********@news.net.uni-c.dk...
在数学表达式中:

(a< b)&& (b< c)

将被描述为:

a< b< c

但是为什么在C中这两个表达式对a,b和c的相同值的评价是不同的?

例如:

a< b< c = 1
(a< b)&& (b 当用C键入时。
In math this expression:

(a < b) && (b < c)

would be described as:

a < b < c

But why is it that in C these two expressions evaluate to something
different for the same values of a, b and c?

e.g:

for a = 0, b = 3 and c = 2:

a < b < c = 1
(a < b) && (b < c) = 0

when typed in C.




(0 <0)&& (0 <0)

false&& false = false根据逻辑AND的真值表



(0 < 0) && (0 < 0)

false && false = false according to the truth table for logical AND




" pemo" <我们************ @ gmail.com>在消息中写道

news:di ********** @ news.ox.ac.uk ...

"pemo" <us************@gmail.com> wrote in message
news:di**********@news.ox.ac.uk...

Paminu ; < JA ****** @ asd.com>在消息中写道
新闻:di ********** @ news.net.uni-c.dk ...

"Paminu" <ja******@asd.com> wrote in message
news:di**********@news.net.uni-c.dk...
在数学中这个表达式:

(a< b)&& (b< c)

将被描述为:

a< b< c

但是为什么在C中这两个表达式对a,b和c的相同值的评价是不同的?

例如:

a< b< c = 1
(a< b)&& (b 当用C键入时。
In math this expression:

(a < b) && (b < c)

would be described as:

a < b < c

But why is it that in C these two expressions evaluate to something
different for the same values of a, b and c?

e.g:

for a = 0, b = 3 and c = 2:

a < b < c = 1
(a < b) && (b < c) = 0

when typed in C.



(0< 0)&& (0 <0)

假&& false = false根据逻辑AND的真值表



(0 < 0) && (0 < 0)

false && false = false according to the truth table for logical AND




哎呀 - 抱歉 - 那里太快了!


(0 < 3)&& (3< 2)

true&& false = false - 逻辑AND要求两个操作数都为真

a真实结果



Oops - sorry - bit too quick there!

(0 < 3) && (3 < 2)

true && false = false - logical AND requires both operands to be true to get
a true result


pemo写道:
pemo wrote:

pemo <我们************ @ gmail.com>在消息中写道
新闻:di ********** @ news.ox.ac.uk ...

"pemo" <us************@gmail.com> wrote in message
news:di**********@news.ox.ac.uk...

" Paminu" < JA ****** @ asd.com>在消息中写道
新闻:di ********** @ news.net.uni-c.dk ...

"Paminu" <ja******@asd.com> wrote in message
news:di**********@news.net.uni-c.dk...
在数学中这个表达式:

(a< b)&& (b< c)

将被描述为:

a< b< c

但是为什么在C中这两个表达式对a,b和c的相同值的评价是不同的?

例如:

a< b< c = 1
(a< b)&& (b 当用C键入时。
In math this expression:

(a < b) && (b < c)

would be described as:

a < b < c

But why is it that in C these two expressions evaluate to something
different for the same values of a, b and c?

e.g:

for a = 0, b = 3 and c = 2:

a < b < c = 1
(a < b) && (b < c) = 0

when typed in C.



(0< 0)&& (0 <0)

假&& false = false根据逻辑AND的真值表



(0 < 0) && (0 < 0)

false && false = false according to the truth table for logical AND



哎呀 - 抱歉 - 那里太快了!

(0< 3)&& (3< 2)

true&& false = false - 逻辑AND要求两个操作数都为真
获得真实结果



Oops - sorry - bit too quick there!

(0 < 3) && (3 < 2)

true && false = false - logical AND requires both operands to be true to
get a true result




是但是接着怎么样


0< 3< 2


如何评估?



Yes but then what about

0 < 3 < 2

how is that evaluated?


这篇关于“a&lt; b&lt; C&QUOT;不同于“(a&lt; b)&amp;&amp; (b <c)“?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆