题型:综合题 题类:常考题 难易度:普通
浙江省高中信息技术 算法及VB语言基础单元检测
Private Sub Command1_Click()
Dim a(1 To 8) As Integer
Dim n, i, j, x As Integer
List1.Clear
List2.Clear
a(1) = -5: a(2) = 3: a(3) = 4: a(4) = 12: a(5) = 20: a(6) = 45: a(7) = 70
For j = 1 To 7
List1.AddItem Str(a(j))
Next j
x = Val(Text1.Text)
i = 1
Do While x > a(i) And i < 8 ’找x的插入位置
①
Loop
For j = 8 To i + 1 Step -1 ’移动数据
②
Next j
a(i) = x
For j = 1 To 8
List2.AddItem Str(a(j))
Next j
Label1.Caption = “插入的位置是” &Str(i)
End Sub
①处填入的代码为。
②处填入的代码为。
试题篮