①通过在线翻译网站把英文翻译成中文 ②Excel 软件中的“自动填充”功能
③“AlphaGo”围棋程序与人类对弈 ④使用二维码生成器生成二维码
⑤通过指纹解锁功能打开手机界面
Private Sub Command1_Click()
Dim s As String, a As String, t As String
s = Text1.Text: t = ""
For i = 1 To Len(s)
a = Mid(s, i, 1)
If a >= "0" And a <= "9" Then
t = t + a
ElseIf a = "!" Then
t = ""
ElseIf t <> "" Then
List1.AddItem t
End If
Next i
End Sub
执行程序时,在文本框 Text1 中输入“12+34=46!789ok”(不包括双引号),单击按钮Command1后,在列表框List1中显示的结果是( )
t = "": i = 1 : j = 9 : f = False
Do While i <= j And Not f
m = (i + j) \ 2
t = t + Str(m)
If a(m) = key Then
t =t +“#”
f = True
ElseIf a(m) > key Then
i = m + 1
t = t + "→"
Else
j = m - 1
t = t + "←"
End If
Loop
数组元素 a(1)到 a(9)的值依次为“68、56、52、36、32、28、26、22、20”,执行该程序段,t的值可能是( )
图2
则他制作图表的数据区域是
密码强度判断条件如下:密码长度小于6,则强度为“弱”。在密码长度大于等于 6 的情况下,若只出现一种字符,则密码强度为“弱”;若出现两种不同字符,则密码强度为“中”,出现3种以上不同字符,则密码强度为“强”。
Private Sub Cmd1_Click()
Dim n As Integer, i As Integer, m As Integer, s As String, c As String
If n < 6 Then
Label3.Caption = "弱"
Else
s = "0000"
For i = 1 To n
c = Mid(Text1.Text, i, 1)
If c >= "0" And c <= "9" Then
Mid(s, 4, 1) = "1" '将字符串 s 第 4 位上的字符替换为"1"
ElseIf c >= "A" And c <= "Z" Then
Mid(s, 3, 1) = "1"
ElseIf c >= "a" And c <= "z" Then
Else
Mid(s, 1, 1) = "1"
End If
Next i
m = 0
For i = 1 To 4
If Mid(s, i, 1) = "1" Then
Next i
If m < 2 Then
Label3.Caption = "弱"
ElseIf m = 2 Then
Label3.Caption = "中"
Else
Label3.Caption = "强"
End If
End If
End Sub
在“花灯”图层第 30 帧到第 45 帧之间制作了“花灯”由完全透明到完全显示的补间动画,则第 30帧“花灯”实例的颜色 Alpha 值应设置为。
实现该功能的VB程序如下,但加框处代码有错,请改正。
Const n = 10
Dim a(1 To n) As Integer
Private Sub Form_Load()
随机产生 n 个不重复的整数存数组 a,并在列表框 list1 中显示。代码略。
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, t As Integer
Dim imin1 As Integer, imin2 As Integer
For i = 1 To n \ 2
imin1 = i: imin2 = i + 1
If a(imin1) > a(imin2) Then t = imin1: imin1 = imin2: imin2 = t
For j = i + 2 To n - i + 1
If a(j) < a(imin1) Then
imin2 = imin1: imin1 = j
'①
imin2 = j
End If
Next j
If i <> imin1 Then t = a(i): a(i) = a(imin1): a(imin1) = t
If imin2 = i Then '②
If n - i + 1 <> imin2 Then
t = a(n - i + 1): a(n - i + 1) = a(imin2): a(imin2) = t
End if
Next i
For i = 1 To n
Text2.Text = Text2.Text + Str(a(i))
Next i
End Sub
① ②
Const n = 6
Dim a(1 To n ^ 2) As Integer, b(1 To n ^ 2) As Integer
Private Sub Form_Load()
'产生n*n个两位随机正整数,保存数组a,显示在List1中,代码略。
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, xy(1 To 4) As Integer
Dim s As String, tmp As String, c As String
s = Text1.Text + "," + Text2.Text + ","
tmp = "": j = 0
For i = 1 To Len(s)
c = Mid(s, i, 1)
If c >= "0" And c <= "9" Then
tmp = tmp + c
Else
j = j + 1
tmp = ""
End If
Next i
For i = 1 To n
For j = 1 To n
If i>= xy(1) And i<= xy(3) And j >= xy(2) And j <= xy(4) Then
b((i - 1) * n + j) =
Else
b((i - 1) * n + j) = a((i - 1) * n + j)
End If
Next j
Next i
List2.Clear: c = ""
For i = 1 To n * n
c = c + Str(b(i))
If Then
List2.AddItem c
c = ""
End If
Next i
End Sub