题型:综合题 题类:常考题 难易度:困难
浙江省杭州地区重点中学2018-2019学年高二下学期信息技术期中考试试卷
Private Sub Command1_Click()
Dim i As Integer
Randomize
For i = 1 To 100
f(i) = False
Next i
n = Val(Text1.Text)
For i = 1 To n
t = Int(Rnd * 100 + 1)
Do While f(t) = True
Loop
f(t) = True
Next i
j = 0
For i = 1 To 100
If Then
j = j + 1
a(j) = i
List1.AddItem Str(i)
End If
Next i
End Sub
Private Sub Command2_Click()
Dim b(1 To 100) As Integer, k As Integer, c As Integer, max As Integer
Dim s As String
Dim j As Integer
n = Val(Text1.Text)
max = 0
For k = 1 To n
i = 1: j = n: c = 0
Do While i <= j
m = (i + j) \ 2: c = c + 1
If c > max Then max = c
If m = k Then b(m) = c: Exit Do
If m < k Then i = m + 1 Else j = m - 1
Loop
Next k
For i = 1 To max
s = ""
For j = 1 To n
If Then
s = s + Str(a(j))
Else
s = s + ""
End If
Next j
List2.AddItem s
Next i
End Sub
试题篮