2017-10-20 38 views
0

更新版本。寻找猛禽地区降雨量的最高值和最低值

我已经想出了我以前的问题,但我仍然不确定如何做最后一部分。我不知道如何获取括号内的数字,而不是获取存储在其中的值。数组由12个数字组成,例如我正在寻找可能是20的最高值,并且已经输入到第4个点。我只能弄清楚如何让它显示20,但我想显示4。它有用户输入,所以应显示的数字可能会有所不同,我不确定如何完成此操作。
我只需要显示最高和最低值的数组编号。我不知道我是否使用了错误的数组。

The main is the first section which is calling the other functions

The getInput function and assigns the entered values to one of 12 numbers in the array

The calculateTotal function which just adds all the values up.

The calculateAverage function which takes all the numbers entered and finds the average

The findHigh function which figures out which number entered is the highest. I have another function almost identical to this but finding the lowest. These are the two that need to show the arrays number and not the value that is saved inside of it.

displayResults function page which will display the values.

+0

我对你指的是哪一段迷茫。 – Matt

+0

对不起,当我发布它看起来不同。第三张照片是它一直阻止我说的,并且说没有找到最高值。 – alice83

回答

0

所以你有几个问题,但容易修复。这只会修复最高值的图像3。

1)当设置highestValue你说的最高值等于[一月,amountOfRain。你需要说highestValue <- data[1,2]。这会指向amountOfRain

2.)您需要更改您的Call或您的变量highestValue的名称,因为它存在冲突。

给那些尝试,让我知道你得到什么。