题型:综合题 题类:常考题 难易度:普通
浙江省精诚联盟2020-2021学年高三上学期信息技术12月适应性联考试卷
为实现上述功能,小王编写如下VB程序,首先在Text1中输入两个满足条件的序列,数字之间用“,”隔开且以“,”结尾,单击按钮“Cod1”,在Text2中输出最小值所在序列中的位置,程序运行界面如下图所示。
Private Sub Cod1_Click( )
Dim s As String, ch As String
Dim i As Integer, j As Integer, n As Integer, c As Integer
Dim a(100) As Integer
s = Text1.Text: c = 0: n = 0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
Else
n = n + 1
c = 0
End If
Next i
i = 1: j = n
Do While
m = (i + j) \ 2
If a(m) > a(i) Then
i = m
Else
j = m
End If
Loop
End Sub
位置 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
数据 |
64 |
67 |
45 |
145 |
|
269 |
|
|
|
119 |
1275 |
试题篮