|
发表于 2020-1-25 20:27:02
|
显示全部楼层
既然问了,就告诉你,我也是从那个不会的阶段过来的,不过,不会下次记得自己可以到网上去查
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oRandom As New Random
Dim iNum As Integer = 0
Dim maxOfArray As Integer = 0
Dim minOfArray As Integer = 0
Dim aveOfArray As Double = 0
Dim sumOfArray As Integer = 0
Dim array As New List(Of String)
Dim i As Integer = 0
For i = 0 To 10
iNum = oRandom.Next(100)
sumOfArray = sumOfArray + iNum
array.Add(iNum.ToString)
Label1.Text = Label1.Text + iNum.ToString() + "," '显示随即生成的10个数字
Next
aveOfArray = sumOfArray / 10
array.Sort()
Label2.Text = "最大值" + array(9).ToString() + "最小值" + array(0).ToString() + "平均值" + aveOfArray.ToString()
End Sub
End Class |
|