题型:综合题 题类:常考题 难易度:困难
浙江省桐庐分水高级中学2019-2020学年高三上学期信息技术第一次月考试卷
实现上述功能的VB程序如下,在橫线处填入合适的代码。
Const n = 10
Dim a(1 To n) As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer, t As Integer
Dim k As Integer, bottom As Integer
'获取排序前数据,依次存储在数组 a 中,并在文本框 Text1 中显示。代码略
bottom = n: i = 1
Do While i <= bottom - 1
k = i: j = bottom
Do While j > i
If a(j) < a(k) Then
k = j
ElseIf a(j) = a(i) Then '若发现重复数据,进行剔除处理
a(j) = a(bottom)
IfThen k = j
bottom = bottom - 1
End If
j = j - 1
Loop
If k <> i Then
t = a(k): a(k) = a(i): a(i) = t
Else
EndIF
Loop
For i = 1 To
Text2.Text = Text2.Text + Str(a(i))
Next i
End Sub
试题篮