Public Class Form1
Dim i
Dim isFound = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim s = Val(InputBox("請輸入要找的值?"))
Dim sN
Dim a() = {2, 1, 5, 10, 22, 34, 17}
For i = 0 To 6
If a(i) = s Then
isFound = True
sN = i
End If
Next
If isFound = True Then
MsgBox("找到了在註標" & sN & "處")
MsgBox("也就是一般習慣稱的第" & sN + 1 & "個")
Else
MsgBox("未找到")
End If
End Sub
End Class
沒有留言:
張貼留言