题型:综合题 题类:常考题 难易度:困难
浙江省“七彩阳光”2020届新高考研究联盟高三信息技术12月适应性考试试卷
Private Sub Command1_Click()
Dim n As Integer, L As Integer, t As Integer
Dim i As Integer, j As Integer, k As Integer
Dim s As String, result As String
Dim a(1 To 50) As Integer, dir(1 To 50) As Integer
L = Val(Text1.Text): n = Val(Text2.Text): t = Val(Text3.Text) s = Text4.Text
s = s + ".": tmp = 0: k=0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
tmp = tmp * 10 + Val(ch)
Else
k = k + 1
a(k) = tmp: dir(k) = 1
tmp = 0
End If
Next i
For i = 1 To t
For j = 1 To n
IfThen dir(j) = -dir(j)
Else
For c = 1 To n
IfThen dir(c) = (-1) * dir(c)
dir(j) = (-1) * dir(j)
End If
Next c
End If
Next j
Next i
For i = 1 To n
result = result + Str(a(i))
Next i
Label5.Caption = Str(t) + "秒后小球的位置为:" + result
End Sub
1 | 5 | 7 | 9 |
4 | 6 | 10 | 15 |
8 | 11 | 12 | 19 |
14 | 16 | 18 | 21 |
已知数据逐行存储在数组a中,在杨氏矩阵数组中查找某数字是否存在的VB程序段如下:
cz = False : i = 1 : j = n
Do While j >= 1 And i <= n
If key < a(s) Then
⑵
ElseIf key > a(s) Then
⑶
Else
cz = True:Exit Do
End If
Loop
方框中的代码由以下三部分组成:
①j = j - 1
②s = (i - 1) * n + j
③i = i + 1
代码顺序正确的选项是( )
试题篮