题型:综合题 题类:常考题 难易度:普通
浙江省诸暨市牌头中学2018-2019学年高二上学期信息技术期中考试试卷
实现上述功能的VB程序如下:
Dim a(1 To 8)As Integer ‘存储道次编号
Dim b(1 To 8)As Single ‘存储运动员成绩
Dim num As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer, k As Integer, p As Integer
Dim t As Single
For i=1 To 7
k=i
For j=i+1 To 8
If Then
k=j
End If
Next j
If k<>i Then
p=a(i):a(i)= a(k):a(k)= p
t=b(i):b(i)= b(k):b(k)= t
End If
Next i
For i=1 To 8
List2.AddItem Str(a(i))&“道:”& Str(b(i))
Next i
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) ’按回车键录入比赛成绩
Dim cj As Single
If KeyAscii=13 Then ‘是否为回车键
num=num+1
cj=Val(Text1.Text)
If cj>0 And num<=8 Then
a(num)= num
List1.AddItem Str(a(num))&“道:”&Str(b(num))
Else
MsgBox “输入无效”
End If
Text1.Text=“”
End If
End Sub
试题篮