s1 = "2019GaoKao"
For i = 1 To Len(s1)
ch = Mid(s1, i, 1)
If ch >= "0" And ch <= "9" Then
ch = Str((Val(ch)+1) Mod 10)
s2 = ch + s2
ElseIf ch >= "a" And ch <= "z" Then
ch = Chr(Asc(ch) - 32) s2 = s2 + ch
End If
Next i
该程序运行后,s2的值是( )
s = Text1.Text:n = Len(s)
'按s中字符顺序从左到右依次存入到数组a中,代码略
i = 1
Do While i <= n - 1
t = ①
For j = n - 1 To i Step -1
a(j + 1) = a(j)
Next j
②
i = i + 1
Loop
For i = 1 To Len(s)
Text2.Text = Text2.Text + ③
Next i
n = 7
For i = 1 To n \ 2
For j = n - i + 1 To i + 1 Step -1
If a(j) Mod 10 > a(j - 1) Mod 10 Then
t = a(j): a(j) = a(j - 1): a(j - 1) = t
End If
Next j
Next i
已知a(1)到a(7)各元素初值分别是31、22、73、54、85、26、37,运行上述程序后,a(1)到a(7)各元素的值分别是( )
i=1:j=10:key=Val(Text1.Text) Do While i <= j m = (i + j + 1) \ 2 If a(m) >= key Then j = m - 1 Else i = m + 1 End If Loop (程序 a) | i=1:j=10: key=Val(Text1.Text) Do While i <= j m = (i + j + 1) \ 2 If a(m) > key Then j = m - 1 Else i = m + 1 End If Loop (程序b) |
以下说法正确的是( )
图a |
图b |
图a |
图b |
Const n = 20
Dim i As Integer
Dim a(1 To n) As String
Private Sub Form_Load()
Randomize
For i = 1 To n
a(i) =
Text1.Text = Text1.Text + " " + a(i)
Next i
End Sub
Private Sub Command1_Click()
Dim k As Integer, count As Integer
Dim b(0 To 7) As Integer
k = Val(Text2.Text)
For i = 1 To n
Next i
i = 1
Do While i < 7 And b(i) < k
i = i + 1
Loop
Key = i
count = 0
For i = 1 To n
If a(i) = Chr(Key + 64) Then count = count + 1
If count = Then Exit For
Next i
Text3.Text = "第" + Str(k) + "小的字母是:" + Chr(Key + 64) + ";位置是:" + Str(i) End Sub
Dim s As String, ch As String
Dim i As Integer, data As Integer
Const n = 8
Private Sub Form_Load()
For i = 1 To n
'随机生成n位小写字母显示在文本框Text1中
Next i
End Sub
Private Sub Command1_Click()
Dim count As Integer, j As Integer, m As Integer
Dim a(1 To 64) As Integer
Dim b(1 To 64) As Integer
Const sj = "0123456789ABCDEF"
s = Text1.Text: count = 0
For i = 1 To Len(s)
data = Asc(Mid(s, i, 1))
Do While count <> n
data = data \ 2
count = count + 1
Loop
count = 0
Next i
tmp = 0
For m = 1 To n * n
i = (m - 1) \ n + 1: j = (m - 1) Mod n + 1
b((i - 1) * n + j) =
s1 = s1 + Str(b((i - 1) * n + j))
If j Mod n = 0 Then List1.AddItem s1: s1 = ""
tmp =
If j = 4 Or j = 8 Then
s2 = s2 + Mid(sj, tmp + 1, 1): tmp = 0
End If
Next m
Text2.Text = s2
End Sub