如何在不使用任何比较的情况下找到最大的三个数字 运算符或三元运算符??
How to find the greatest of three numbers without using any comparison operator or ternary operator??
推荐答案" Amar Kumar Dubedy" < ad ***** @ yahoo.co.inwrote in message news:11 ********************** @ e9g2000prf.googlegro ups ... "Amar Kumar Dubedy" <ad*****@yahoo.co.inwrote in message news:11**********************@e9g2000prf.googlegro ups... 如何在不使用任何比较的情况下找到最大的三个数字 运算符或三元运算符? ? How to find the greatest of three numbers without using any comparison operator or ternary operator??
如果数字是正整数 如果b大于a,则a / b为零。 C允许比较为零,所以如果(a / b)相当于if(ba) ,你可以围绕它建立第一个刺。 - 免费游戏和编程好东西。 www.personal.leeds.ac.uk/~bgy1mm
Amar Kumar Dubedy写道,在01/07/07 07:36: Amar Kumar Dubedy wrote, On 01/07/07 07:36: 如何找到最大的没有使用任何比较的三个数字 运算符或ternar y操作员? How to find the greatest of three numbers without using any comparison operator or ternary operator??
将它们全部放入戒指,扔进武器,然后等待查看哪一个 活着出来。 如果是家庭作业,自己动手,如果你做了一些愚蠢的测验,那就自己做吧。如果你在这里发布一个尝试,人们*可能会帮忙,但是为什么我们应该为你做这个? - Flash Gordon
Put them all in a ring, throw weapons in, and wait to see which one comes out alive. If it is homework, do it yourself, if you are doing some stupid quiz, do it yourself. People *might* help if you post an attempt here, but why should we do it for you? -- Flash Gordon
Amar Kumar Dubedy说: Amar Kumar Dubedy said: 如何在不使用任何比较的情况下找到最大的三个数字 运算符或三元运算符?? How to find the greatest of three numbers without using any comparison operator or ternary operator??
确保其中一个数字是LDBL_MAX,并且只需从求解函数返回LDBL_MAX 。这样,你根本不需要任何 的运营商。 - Richard Heathfield< ; http://www.cpax.uk> 电子邮件:-www。 + rjh @ 谷歌用户:< www.cpax.uk/prg/writings/googly.php> Usenet是一个奇怪的放置" - dmr 1999年7月29日
Ensure that one of the numbers is LDBL_MAX, and simply return LDBL_MAX from your solving function. That way, you don''t need any operators of any kind at all. -- Richard Heathfield <www.cpax.uk> Email: -www. +rjh@ Google users: <www.cpax.uk/prg/writings/googly.php> "Usenet is a strange place" - dmr 29 July 1999
更多推荐
三个数字中最大的一个
发布评论