①机器人通过语音与人交流
②某手机 APP 将语音信息转换为文本
③计算机程序根据输入的三条边长自动计算三角形面积
④某软件识别用户拍摄的花卉照片并返回花卉品种等信息
⑤Word软件的自动更正功能将键入的“cpoy”自动更正为“copy”
s=0
For k = 3 To 1 Step -1
If k <= 1 Then x = 1
If k <= 2 Then x = 2
If k <= 3 Then x = 3
s = s + x
Next k
该程序段运行后,变量 s 的值是( )
x = 86420: s1 = "ByeBye2020": s2 = "Fighting2021" result = ""
Do While x > 0
r = x Mod 10
If r Mod 3 = 0 Then
result = Mid(s1, r + 1, 1) & result
Else
result = result & Mid(s2, r + 1, 1)
End If
x = x \ 10
Loop
Text1.Text = result
执行该程序段后,文本框Text1中显示的内容是( )
For i = 1 To 6
x = Int(Rnd * 10) +1
If i Mod 2 = 1 Then
a(i) = 2 * x + 1
ElseIf x mod 2 = 0 then
a(i) = x \ 2
Else
a(i) = x - 1
End If
Next i
执行程序后,a数组各元素可能的是( )
图 b
图 a
图b
Private Sub Cmd1_Click()
Dim s As String, s1 As String, t As Integer, i As Integer
Dim k As Integer, bh As Integer, w As Integer
Dim w1 As Integer, w2 As Integer
s = Text1.Text: k = 1: t = 0: bh = 0 'bh存储当前垃圾的垃圾编号
w1 = 0: w2 = 0
For i = 1 To Len(s) s1 = Mid(s, i, 1)
If Then
t = t * 10 + Val(s1)
Else
If Then
bh = t
Else
If bh = 1 Then
w1 = w1 + t
Else
w2 = w2 + t
End If
End If
k = k + 1
End If
Next i
List1.AddItem "干垃圾共" + Str(w1) + "斤"
List1.AddItem "湿垃圾共" + Str(w2) + "斤"
Label3.Caption = "总重量共有" + Str(w) + "斤"
End Sub
①从左往右扫描,若其中存在连续上升数字字符,则进行压缩。其中,数字字符串“91”也算连续上升。连续上升的数字字符不超过9个,若超过9个则该数字字符串分成两段。例如:“12324789123456789”可以压缩成“1-3247-67-9”
②对压缩后的数字字符进行加密,其中,数字字符“1”-“9”用加密字符“A”-“I”表示,未经压缩的数字字符原样输出。例如:“1-3247-67-9”加密后是“A-C24G-FG-I”。
程序界面如图所示。
Private Sub Command1_Click()
Dim s As String, k As Integer, i As Integer, t As Integer
Dim sjg As String, mw As String, start1 As Integer, end1 As Integer Dim a(1 To 100) As Integer
mw = "ABCDEFGHI"
t = 1
a(1) =
For i = 2 To Len(s)
a(i) = Val(Mid(s, i, 1))
If Then
t = t + 1
Else
If t > 1 Then
start1 =
end1 = a(i - 1)
sjg = sjg + Mid(mw, start1, 1) + "-" + Mid(mw, end1, 1)
Else
sjg = sjg + CStr(a(i - 1)) ‘CStr 函数将表达式转换为字符串,并去除前导空格
End If
t = 1
End If
Next i
Text2.Text = sjg
End Sub