题型:综合题 题类:模拟题 难易度:困难
浙江省温州市2018届高三下学期信息技术3月适应性考试(二模)试卷
实现上述功能的 VB 程序如下,请回答下列问题:
Dim xm(1 To 600) As String '存储学生姓名
Dim xx(1 To 600) As Integer '存储信息成绩
Dim ty(1 To 600) As Integer '存储通用成绩
Dim n As Integer '存储记录总数
Private Sub Form_Load()
'本过程从数据库中读取学生数据,存储在相应的变量中,并在 List1 中显示'代码略
End sub
Private Sub Command1_Click()
Dim key As Integer, mid As Integer
Dim i As Integer, L As Integer, R As Integer, k As Integer
Dim tmp1 As String, tmp2 As Integer
'以“信息”为主要关键字、“通用”为次要关键字排序
For i = 1 To n - 1
k = i
For j = i + 1 To n
If xx(k) < xx(j) or Then
k = j
End If
Next j
If k <> i Then
tmp1 = xm(k) : xm(k) = xm(i) : xm(i) = tmp1
tmp2 = xx(k) : xx(k) = xx(i) : xx(i) = tmp2
tmp2 = ty(k) : ty(k) = ty(i) : ty(i) = tmp2
End If
Next i '查询记录
key = Val(Text1.Text) L = 1 : R = n
Do While L <= R
mid = (L + R) \ 2
If Then
L = mid + 1
Else
R = mid - 1
End If
Loop
List2.Clear
' vbTab 相当于是键盘上制表符 TAB 按键的功能
List2.AddItem "姓名" & vbTab & "信息" & vbTab & "通用"
For i = 1 to
List2.AddItem xm(i) & vbTab & xx(i) & vbTab & ty(i)
Next i
End sub
试题篮