vb.net程序设计:包括三个过程1事件过程form1用inputbox输入10个数,2函数过程求最大值,3button

1个回答

  • 整数判断还是含有小数?整数判断:

    Dim A(9) As Integer

    Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load

    For i = 0 To 9

    A(i) = Val(InputBox("输入一个数字","输入"))

    Debug.WriteLine("第" & i + 1 & "个数:" & A(i))

    Next

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click

    Debug.WriteLine("最大数为:" & jisuan(A))

    End Sub

    Private Function jisuan(ByVal shuzu() As Integer) As Integer

    Dim max As Integer

    For i = 0 To shuzu.Length - 1

    If shuzu(i) > max Then max = shuzu(i)

    Next

    Return max

    End Function