i = 1
Do While i <= 5
If i = 0 or a(i - 1) <= a(i) Then
i = i + 1
Else
t = a(i): a(i) = a(i - 1): a(i - 1) = t
i = i - 1
End If
Loop
For i = 1 To 5
List2.AddItem a(i)
Next i
数组元素a(0)到a(5)的值依次为“0,71,22,48,79,27”,经过该程序段“加工”后,数组元素a(4)的值为( )
Private Sub Command1_Click()
Dim n As Integer, i As Integer, a As Integer, b As Integer
Randomize
n = Val(Text1.Text)
i =
Do While i <= n
a = Int(Rnd * 100)
b = Int(Rnd * 100)
If Then
List1.AddItem "(" + Str(i) + " )" + Str(a) + "+" + Str(b) + "="
i = i + 1
End If
Loop
End Sub
x = InputBox("输入x的值:")
If x > 3 Then
If x <= 6 Then
y = 2 * x
Else
y = 3 * x
End If
Else
y = 4 * x
End If
Print y若x、y均是整型变量,程序运行并输入6,则y的值是( )
Dim a(l To 100) As String
Private Sub Commandl_Click()
Dim c As Integer, t As String, ans As String
s = Textl. Text
k = Val(Text2. Text)
ans =“”
For i = 1 To Len(s) - k - 1
c = c + 1
a(c) = Mid(s, i, 1) + Mid(s, i + k + 1, 1)
If check(c) Then
ans = ans + a(c) + ","
Else
c = c - 1
End If
Next i
Text3. Text = ans
End Sub
Function check(k As Integer) As Boolean
Dim i As Integer
check = True
For i = 1 To k - 1
If a(i) = a(k) Then check = False: Exit For
Next i
End Function
若该程序段执行后,在文本框Text1中输入的字符串长度不超过10,文本框Text2中输入的值在0到8范围内(输入输出都不包括双引号本身),下列说法不正确的是( )
max=a(1)
For i=2 To 10
Next i
当虚线框内的语句刚好执行完第6次后(此时循环变量i的值为7),变量max的值是( )
i=1:j=10:temp=a(5)
Do While a(j)>temp
j=j-1
Loop
Do While a(i)<temp
i=i+1
Loop
temp=a(i):a(i)=a(j):a(j)=temp
数组元素a⑴到a(10)的值依次为“36 91 36 17 93 99 2 9 97 97”,执行该程序段后,a(5)的值为( )
For i= 1 To 8
a(i) =Int(Rnd*2)
Next i
sum= 0
For i=1 To 8 Step 3
For j=i To 8
a(j)=1-a(j)
Next j
sum=sum+a(i)
Next i
Text 1.Text=Str(sum)
执行该程序段后,文本框Text 1中显示的内容不可能是( )
例如,以下汉字点阵图案:
0001000
0001000
0001111
0001000
0001000
0001000
1111111
对应的压缩码是031616431616137,表示开始数字是0,有3个,接下来1个1,6个0,1个1……
Private Sub Commandl_Click()
Dim code As String,c As Integer,res As String,k As Integer
code=Text 1.Text
k=0
res=""
c=Val(Mid(code,1,1))
For i=2 To Len(code)
For j=1 To ‘①
res=res +Str(c)
k= k+1
If k=7 Then
List1.AddItem res
k=0
res=""
End If
Next j
c= ‘②
Next i
End Sub
①②
则压缩码为。
Dim a(1 To 5) As Integer
a(1) = 1
For i = 2 To 5
a(i) = Int(Rnd( ) * 3) + 3
Next i
For i = 2 To 5
If a(i) Mod 2 = 1 Then
a(i) = a(i) + a(i - 1)
Else
a(i) = a(i) / 2
End If
Next i
执行程序后,a数组各元素可能是( )