题型:综合题 题类:常考题 难易度:困难
浙江省台州中学2018届高三上学期信息技术第四次统练试卷
实现上述功能的VB程序如下,但加框处代码有错,请改正。
Const n = 50
Dim d(0 To n) As single , name(1 to n) as string
'读入50个学生的身高,依次存入d(1)…d(50),姓名存入name(1)…name(50) '代码略
Private Sub Command1_Click()
Dim i As Integer, j As Integer, temp As single, k As Integer,r as string
d(0) = 2
For i = 1 To 10
①
For j = i To n
If d(j) < d(i - 1) Then
If ② Then
k = j
End If
End If
Next j
If k <> i Then
temp = d(k): d(k) = d(i): d(i) = temp
r=name(k) : name(k)=name(i) : name(i)=r
End If
Next i
For i = 1 To 10 ‘输出被选的10个人的名字和身高。
List2.AddItem name(i) & d(i)
Next i
End Sub
① ②
试题篮