I have a small subroutine where I have two arrays (one for temperatures and one for hours). I must get the highest temperature and at the time it was. But at the time of loading the data, if I enter only two data, the subroutine works correctly, otherwise, if I enter more data, it starts printing many times.
Here the code.
**Sub InformeTemperaturasMaximas(ByRef temperaturasArray() As Double, ByRef horasArray() As Byte)
Dim i As Integer
Dim maxTemp As Byte = 0
''PARA SACAR LA TEMPERATURA MAXIMA
For i = 1 To UBound(temperaturasArray)
For j = 1 To UBound(horasArray)
If temperaturasArray(i) > temperaturasArray(maxTemp) Then
maxTemp = i
End If
Console.WriteLine("La temperatura maxima es de: " & temperaturasArray(maxTemp) & " " & "C°" & " " & "a las" & " " & horasArray(j) & "hs.")
Next
Next
End Sub**
Let's see, I could only do the exercise with VBA in excel