我们可以比较两个整数而不使用关系运算符 [英] can we compare two integers without using relational operators

查看:52
本文介绍了我们可以比较两个整数而不使用关系运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们可以比较两个整数而不使用关系运算符(==!=<

< =>> =)


谢谢

rajesh s

hi
can we compare two integers without using relational operators (== != <
<= > >=)

thanks
rajesh s

推荐答案



raju写道:

raju wrote:
hi
我们可以比较两个整数而不使用关系运算符(==!=<
< =>> =)

谢谢
rajesh s
hi
can we compare two integers without using relational operators (== != <
<= > >=)

thanks
rajesh s




也许你想在指针的情况下比较他们的参考文件但是

那些赢了'不要说女巫是更大的。

或者你想用面具进行比较?

如果你喜欢精确的答案,那就更准确了。



Maybe you want to compare their references in case of pointers but
those won''t say you witch is the greater.
Or maybe you would like to make the comparision on bits with a mask?
Be more precise if you like precise answers.


raju写道:

我们可以比较两个整数而不使用关系运算符(==!=<
< =>> =)
hi
can we compare two integers without using relational operators (== != <
<= > >=)




是的。



yes.


" raju" ; < RA ******** @ gmail.com>写道:
"raju" <ra********@gmail.com> writes:
我们可以比较两个整数而不使用关系运算符(==!=<
< =>> =)
can we compare two integers without using relational operators (== != <
<= > >=)



我们经常得到这样的问题。它大概是

相当于询问我可以在不使用

螺丝刀的情况下开螺丝吗?答案是肯定的:你可以使用一把锤子(但是当你完成了b





$ b)或者你可以用一把钳子并用手将其拧干(但是它会变得非常繁琐)。我确定还有其他解决方案。


比较两个整数的方法是使用关系运算符。

这就是他们的'是的。


是的,有可能在不使用

关系运算符的情况下进行比较。如果你能给我们一个很好的理由,你为什么要这样做呢?我们也许可以提供帮助。如果它只是一个没有实际应用的编程挑战,那么我们中的一些人可能会对它们感兴趣。


如果这是家庭作业,你应该自己做。如果您的

教练想要使用Usenet而不是他的学生的答案,

他可以自己发布。


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti .net / ~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



We get this kind of question fairly frequently. It''s roughly
equivalent to asking "Can I drive a screw without using a
screwdriver?" The answer is yes: you can use a hammer (but neither
the screw nor the wood is going to be in very good shape when you''re
done), or you can use a pair of pliers and twist it in by hand (but
it''s going to be *very* tedious). I''m sure there are other solutions.

The way to compare two integers is to use a relational operator.
That''s what they''re for.

Yes, there are probably ways to do comparisons without using
relational operators. If you can give us a good reason why you''d want
to do such a thing, we may be able to help. If it''s just a
programming challenge with no actual practical application, some of us
might be interested enough to play along.

And if it''s a homework assignment, you should do it yourself. If your
instructor wanted answers from Usenet rather than from his students,
he could have posted himself.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


这篇关于我们可以比较两个整数而不使用关系运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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