我怎样才能获得此变量具有最高的价值? [英] How can I obtain which of this variables have the highest value?

查看:157
本文介绍了我怎样才能获得此变量具有最高的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须知道这些变量具有最高值:

I have to know which of these variable have the highest value:

A=1
B=500
C=100
D=700
E=5
F=1000

这是做最简单的方法?

Which is the easiest way to do this?

推荐答案

您可以选择其中一个作为具有最高价值的潜力变量。然后通过所有的变量进行迭代。在每次迭代中,看是否该变量比您的候选更高的价值。如果是,更换您的候选人。当你已经完成了所有的变量迭代中,潜在候选变量是具有最高值的实际变量。

You can pick one of them as the potential variable with the highest value. Then iterate through all the variables. At each iteration, see if that variable has a higher value than your candidate. If it does, replace your candidate. When you have iterated through all the variables, the potential candidate variable is the actual variable with the highest value.

这篇关于我怎样才能获得此变量具有最高的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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