题型:综合题 题类:模拟题 难易度:普通
2017年11月浙江省普通高校招生学考科目考试技术(信息技术)仿真模拟试题02
实现上述功能的VB程序代码如下,请在划线处填上合适的代码。
Dim a( 1 To 20) As Integer
Private Sub Command1_Click ( )
Dim key As Integer
key = ①
i = 1
Do While key > a ( i ) And ( i <= 1 5 )
i = i + 1
Loop
Label4.Caption = “该数插入的位置是:” + Str ( i )
If i = 16 Then
a ( i ) = key
Else
For j = 16 To i + 1 Step -1
②
Next j
a ( i ) = key
End If
List2. Clear
For i = 1 To 16
List2.AddItem a( i)
Next i
End Sub
Private Sub Form_Load( )
'随机生成15个200以内的正整数
Randomize
For i = 1 To 15
a ( i ) = Int(Rnd * 200) + 1
Next i
'将15个数从小到大排序
For i = 1 To 14
k = i
For j = i + 1 To 15
If a ( k ) > a ( j ) Then k = j
Next j
If i <>k Then
t = a(i); a( i) = a ( k ):a ( k )
End If
Next i
'将排好序的数输出在列表框Listl中
Listl.Clear
For i = 1 To 15
Listl.AddItem str ( a ( i ) )
Next i
End Sub
程序中①划线处应填入,程序中②划线处应填入
试题篮