①微信聊天中的语音转文字
②“道路监控系统”监测高速公路的通行情况
③使用QQ与网友语音聊天
④在线翻译网站上,输入英文自动翻译成中文
⑤通过手机拍照,“口算作业批改APP程序自动验证口算的正确性
将该按钮应用于“load”场景,下列说法正确的是( )
a(1)=20: a(2)=3: a(3)=21: a(4)=37
a(5)=62: a(6)=20: a(7)=13: a(8)=33
k=Abs(a(2)-a(1))
For i=3 To 8
If Abs(a(i)- a(i-1))>k Then k= Abs(a(i)-a(i-1))
Next i
执行该程序段后,变量k的值为( )
i = 1: j = 10
Do While i <= j
m = (i + j) \ 2
If key <= a(m) Then
‘①
Else
‘②
End If
Loop
For k = 10 To i Step -1
‘③
Next k
a(i) = key
要使程序实现上述功能,则方框①②③中的语句分别是( )
实现上述功能的VB程序如下,但加框处代码有错,请改正。
Const n = 100
Dim a(1 To n)As Integer
Private Sub Form_Load( )
‘随机产生100个0到99之间的整数存数组a中,并在列表框list1中显示。
End Sub
Private Sub Command1_Click( )
Dim i As Integer, j As Integer, t As Integer
Dim b(0 To 9)As Integer, c(0 To 9)As Integer
For i = 1 To n
①
Next i
For i = 0 To 9
b(i) = i
Next i
i = 0
Do While i <= 8
For j = i + 1 To 9
If Then ②
t = b(i): b(i) = b(j): b(j) = t
t = c(i): c(i) = c(j): c(j) = t
End If
Next j
i = i + 1
Loop
List2.AddItem “范围元素个数”
For i = 0 To 9
List2.AddItem Str(b(i) * 10) + "~" + Str(b(i) * 10 + 9) + ": " + Str(c(i)) + "个"
Next i
End Sub
1)初始时,建立一个空字典,把26个小写字母加入字典中。26个小写英文字母编码为1-26,字母“a”的编码为1,字母“b”的编码为2,其它字母的编码依次增加。
2)从字符串第一个位置开始扫描,若遇到空格(空格用“*”表示),则得到一个单词,截取该单词并存入变量中。
3)若该单词在字典中,则取出该单词在字典中的编码值;否则,依次取出该单词中各字母在字典中的编码值,(编码值之间用一个空格分隔),同时产生该单词的编码(编码为字典中的最大编码值加1),加入字典中。
4)继续扫描字符串,截取单词,并按照步骤(3)的方法进行处理,直至整个字符串编码完毕。字符串“abab”LZW编码过程如图所示。
Dim pos As Integer, a(1 To 100)As String
Private Sub Form_Load( )
'将字母“a”至“z”依次存入数组元素a(1)到a(26)
End Sub
Function judge(ss As String) As Integer '判断字典中是否有ss这个单词
Dim i As Integer judge = 0
For i = 27 To pos
If a(i) =Then judge = i
Exit For
End If
Next i
End Function
Private Sub Command1_Click( )
Dim s As String, i As Integer, j As Integer, k As Integer, ch As String, word As String, result As String, Dim id As Integer, idletter As Integer
s = Text1.Text pos = 26: i = 1
Do While i <= Len(s)
j = i
Do While Mid(s, j, 1) <> " " j = j + 1
If j > Len(s) Then Exit Do
Loop
word = Mid(s, i, j - i)
If Len(word) = 1 Then '单个字母的单词
result = result + Str(Asc(word) -Asc("a") + 1)
Else
id = judge(word)
If id = 0 Then '新的单词
For k = 1 To Len(word) '依次处理该单词中的各个字母编码
ch = Mid(word, k, 1)
Next k
pos = pos + 1 '对该单词编码
a(pos) = word
Else '词典中存在该单词
result = result + Str(id) End If
End If
If j < Len(s) Then result = result + " *"
Loop
Text2.Text = result
End Sub