题型:综合题 题类:常考题 难易度:普通
浙江省温州市2021届高三上学期信息技术11月适应性测试卷
请回答下列问题。
Constn= 10
Dim a(1 To n) As Integer
Private Sub Command1_ Click()
Dim Left As Integer, Right As Integer, Lstart As Integer, Rstart As Integer
Dim i As Integer, j As Integer, t As Integer, s As String
'随机生成n个不重复元素的数组a,并在左边环形显示,代码略
k= 1
For i= 2 Ton
If a(i) < a(k) Thenk=i
Next i
Lstart = (k+n- 2) Mod n+ 1: Rstart= k Mod n+ 1
i= 1
Do Whilei<= (n-1)\2
Left = Lstart
For j= 1 To
p= (Left+ n-2) Mod n+ 1
If a(Left) > a(p) Then
t= a(Left): a(Left) = a(p): a(p)= t
End If
Left= p
Next j
Rstart= Rstart Mod n + 1
Right = Rstart
Do While
p=RightModn+1
If Then
t= a(Right): a(Right) = a(p): a(p)=t
End If
Right= p
Loop
Lstart =
i=i+ 1
Loop
排序后的数据在右边环形显示,代码略
End Sub
试题篮