轉到內容

演算法/查詢最大值/visual basic 方法 3

來自 Wikibooks,開放世界的開放書籍
Public Function Pear(ByVal Nums() as Integer) as Integer
Dim AryStart as Integer = 0
Dim AryEnd as Integer = Nums.Length - 1

If AryEnd - AryStart = 1 Then
→If Nums(AryEnd) > Nums(AryStart)
→→Return Nums(AryEnd)
→Else
→→Return Nums(AryStart)
→End if
華夏公益教科書