下图为某次信息考试得分情况,字符串数组class中存储班级学号(如“0112”,前两位表示班级,后两位表示学号),score数组中存储得分。某同学设计了VB程序实现如下功能:在Text1中输入班级(1-18之间的数字),在Text2中输入人数m,单击“刷选”按钮,在列表框List1中刷选出该班符合要求的班级学号和得分。
(1)
下列对象中有Text属性的是 (单选:填字母: A . Command1; B . Form1;C . Text1 ;D . List1)
(2)
为实现上述功能,请在划线处填入合适的代码。
Const n=640
Dim class(1 to n )As String
Dim score(0 to n) As Integer
‘从数据库中读取学号和成绩数据,存入class和Score数组,并在Lis2中显示,代码略
Private Sub Command1Click()
Dim x As integer, m AS Integer, i As Integer,j As Integer
Dim t1 As Integer, t2 As Integer, flag As Boolean
x=Val(Text1.Text)
m=Val(Text2.Text)
i=1: flag=True
Do While flag
k=i
For j=i+1 To n
If t=x Then
It score (j)>score(k) Or Val(Mid(class(k),1,2))<>x Then k=j
End If
Next j
IfAnd score(k) <> score(i-1) Then flag=Fale
If k<>i Then
t1=sore(i): score(i)=score(k): score(k)=t1
t2=class(i): class(i)=class(k): class(k)=t2
End If
i=i+1
Loop
List1.Clear
For j=1 To
List1.Additem class(j)+""+Str(score(j))
Next j
End Sub
答案: 【1】C
【1】t=Val(Mid(class(j), 1, 2))【2】i>m【3】i-2