转到内容

算法/求最大值/visual basic 方法 1

来自维基教科书,一个开放世界的开放书籍
Function FindMax(ByVal x() As Integer) As Integer
        If x.Length = 0 Then
            Return 0
        ElseIf x.Length = 1 Then
            Return x(0)
        Else
            Dim temp As Integer = x(0)

            For i As Integer = 0 To x.Length - 1
                If x(i) > temp Then
                    temp = x(i)
                End If
            Next
            Return temp
        End If
End Function
华夏公益教科书