布尔表达 [英] Bool expression

查看:73
本文介绍了布尔表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




下面的表达式

bool Full(){return((mSize == MAXSIZE)?true:false);}


我的问题是if(mSize == MAXSIZE),它会返回1还是0?


当然我运行代码但它与我想要的规格

得到第二意见。


谢谢

解决方案
" 2005" < uw ***** @ yahoo.com在留言中写道

news:11 ********************* @ h48g2000cwc.googlegro ups.com ...





下面的表达式

bool Full( ){return((mSize == MAXSIZE)?true:false);}


我的问题是if(mSize == MAXSIZE),它会返回1还是0?


当然我运行了代码,但它与我想要的规格相冲突

来获得第二意见。


谢谢



我不明白你的问题。如果mSize等于MAXSIZE函数

将返回true,否则它将返回false,但我不知道为什么它

只是没有编码


返回mSize == MAXSIZE;

会做同样的事情。


< blockquote> 2005写道:





下面的表达式

bool Full() {return((mSize == MAXSIZE)?true:false);}


我的问题是if(mSize == MAXSIZE),它会返回1还是0?



两者都没有,它返回true。当然,写起来会更简单:


返回mSize == MAXSIZE;


如果由于某种原因结果转换为积分型,比

它将是1,而不是0.




Jim Langston写道:


" 2005" < uw ***** @ yahoo.com在留言中写道

news:11 ********************* @ h48g2000cwc.googlegro ups.com ...





下面的表达式

bool Full( ){return((mSize == MAXSIZE)?true:false);}


我的问题是if(mSize == MAXSIZE),它会返回1还是0?


当然我运行了代码,但它与我想要的规格相冲突

来获得第二意见。


谢谢



我不明白你的问题。如果mSize等于MAXSIZE函数

将返回true,否则它将返回false,但我不知道为什么它

只是没有编码



嗯,上面的函数和规格给出了。

我的问题是当它返回true时,它会是1还是0?例如if(Full(

< true))== 1或0?


返回mSize == MAXSIZE;

哪个会做同样的事情。


Hi,

The expression below
bool Full() {return ((mSize==MAXSIZE) ? true : false);}

My question is if (mSize==MAXSIZE), would it return 1 or 0?

Of course I ran the code but it conflicts with the spec that I wanted
to get a second opinion.

Thanks

解决方案

"2005" <uw*****@yahoo.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...

Hi,

The expression below
bool Full() {return ((mSize==MAXSIZE) ? true : false);}

My question is if (mSize==MAXSIZE), would it return 1 or 0?

Of course I ran the code but it conflicts with the spec that I wanted
to get a second opinion.

Thanks

I don''t understand your question. If mSize is equal to MAXSIZE the function
will return true, otherwise it woudl return false, but I don''t know why it
just wasn''t coded

return mSize == MAXSIZE;
which would do the exact same thing.


2005 wrote:

Hi,

The expression below
bool Full() {return ((mSize==MAXSIZE) ? true : false);}

My question is if (mSize==MAXSIZE), would it return 1 or 0?

Neither, it returns "true". Of course, it would be simpler to write:

return mSize == MAXSIZE;

If for some reason the result were converted to an integral type, than
it would be 1, not 0.



Jim Langston wrote:

"2005" <uw*****@yahoo.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...

Hi,

The expression below
bool Full() {return ((mSize==MAXSIZE) ? true : false);}

My question is if (mSize==MAXSIZE), would it return 1 or 0?

Of course I ran the code but it conflicts with the spec that I wanted
to get a second opinion.

Thanks


I don''t understand your question. If mSize is equal to MAXSIZE the function
will return true, otherwise it woudl return false, but I don''t know why it
just wasn''t coded

Well, the function above and a spec was given.
My question is when it returns true, would it be 1 or 0? eg if (Full(
<true)) == 1 or 0 ?

return mSize == MAXSIZE;
which would do the exact same thing.


这篇关于布尔表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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