很抱歉,对排序不是很在行,我会尝试一下的
前三点要求做到了 文件会附上~~
代码如下:
Dim a(1 To 20) As Integer, s(5 To 9), n%
Private Sub Command1_Click()
Dim max%, min%, aver%
aver = 0
max = a(1)
min = 100
Randomize
For i = 1 To 20
a(i) = Int(Rnd * 101)
aver = aver + a(i)
Picture1.Print a(i); " ";
If i Mod 5 = 0 Then Picture1.Print
If max < a(i) Then max = a(i)
If min > a(i) Then min = a(i)
Next i
Picture1.Print
aver = aver / 20
Picture1.Print "最大值为:" & max
Picture1.Print "最小值为:" & min
Picture1.Print "平均数为:" & aver
End Sub
Private Sub Command2_Click()
s(5) = 0: s(6) = 0: s(7) = 0: s(8) = 0: s(9) = 0
For i = 1 To 20
k = a(i) 10
Select Case k
Case 0 To 5
s(5) = s(5) + 1
Case 9 To 10
s(9) = s(9) + 1
Case 6 To 8
s(k) = s(k) + 1
End Select
Next i
Picture2.Print "s(5)的人数为:"; s(5)
Picture2.Print "s(6)的人数为:"; s(6)
Picture2.Print "s(7)的人数为:"; s(7)
Picture2.Print "s(8)的人数为:"; s(8)
Picture2.Print "s(9)的人数为:"; s(9)
Picture2.Print
End Sub