编一VB应用程序。要求如下:

来源:百度知道 编辑:UC知道 时间:2024/05/28 02:18:48
编一VB应用程序。要求如下:
⑴ 随机产生20个学生的VB程序设计课程的成绩,存入一维数组中,并显示结果;
⑵ 求这20个学生的最高分、最低分和平均分,并显示结果;
⑶ 统计各分数段人数,即0~59、60~69、70~79、80~89、90~100,并显示结果;
⑷ 编写可对一组数据进行排序的自定义函数或过程。调用该自定义函数或过程将分数按由高到低的次序排列并输出。
⑸ 窗体界面自行设计。

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button11.Click
Dim ar(20) As String, i As Integer
Dim a As Integer, b As Integer, c As Integer, d As Integer, f As Integer 'a,b,c,d,f 为统计各分数段学生的个数
a = 0
b = 0
c = 0
d = 0
f = 0
For i = 0 To 19
ar(i) = CInt(Rnd() * 100)
If 0 <= ar(i) And ar(i) < 60 Then
a = a + 1
ElseIf 59 < ar(i) And ar(i) < 70 Then
b = b + 1
ElseIf 69 < ar(i) And ar(i) < 80 Then
c = c + 1
ElseIf 79 < ar(i) And ar(i) < 90 Then
d = d + 1
ElseIf 89 < ar(i) And ar(i) <= 100 Then
f = f + 1
End If
Next
Dim min As Integer, max As Integer, sum As Integer,