我正在尝试创建一个 for 循环来循环遍历数组并使用临时变量执行基本切换以循环出最高数字。我还需要打印该元素在数组中的位置。这就是我到目前为止所拥有的。
Dim highest As Decimal = gasArray(0)
Dim j As Integer = 1
For a As Integer = 0 To 11 Step 1
If gasArray(a) < gasArray(a + 1) Then
highest = gasArray(a + 1)
a = j
End If
Next
avgPriceLbl.Text = "$" & highest & " in month " & Array.FindIndex(j)