使用C ++确定三个数字中的最大数字 [英] Determine the largest number among three numbers using C++
本文介绍了使用C ++确定三个数字中的最大数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C ++确定三个数字中最大的数字?
How can I determine the largest number among three numbers using C++?
我需要简化这一点
w=(z>((x>y)?x:y)?z:((x>y)?x:y));
条件并不能简化这一点.
Conditionals do not simplify this.
推荐答案
从C ++ 11开始,您可以
Starting from C++11, you can do
w = std::max({ x, y, z });
这篇关于使用C ++确定三个数字中的最大数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文