题型:综合题 题类:常考题 难易度:困难
浙江省嘉兴市2018-2019学年高三信息技术3月嘉丽联考试卷
实现上述功能的VB程序如下,但加框处代码有错,请改正。
Dim n As Integer,a(1 To 100)As Integer
Private Sub Command1_Click()
’该段程序用于随机产生n个整数,存储在数组a中,并显示在列表框list1中,代码略
End Sub
Private Sub Command2 Click()
Dim i As Integer,j As Integer,tmp As Integer
List2.Clear
tmp=1
For i=1 To n-1
For j=n To i+1 Step-1
If Then ‘①
a(j)=a(j)+a(j-1)
a(j-1)=a(j)-a(j-1)
a(j)=a(j)-a(j-1)
End If
Next j
‘②
Next i
For i=1 To n
List2.AddItem Str(a(i))
Next i
End Sub
① ②
图 a | 图 b |
t=h
p=d[h][1]
while p != -1 :
q=d[p][1]
p=q
d[t][-1]=-1
试题篮