①“伴奏.wav”压缩为“伴奏1.mp3”
②“伴奏1.mp3”压缩为“伴奏.rar”
③“伴奏.rar”解压缩为“伴奏2.mp3”
执行该算法,输出s的值为( )
s = “7218634594”:n = Len(s)
t = 0
For i = 1 To n - 1
a(i) = Val(Mid(s, i, 2))
Next i
For i = 1 To n - 2 Step 2
k = i
For j = i + 2 To n - 1 Step 2
If a(j) < a(k) Then k = j
Next j
If k <> i Then
temp=a(i):a(i)=a(k):a(k)=temp
t = t + 1
End If
Next i
Text1.Text = Str(t)
该程序段运行后,文本框Text1中显示的内容是( )
i = 1: j = 8: t = 0
Key = Int(Rnd() * 20) + 10
Do While i <= j
m = Int((i + j) / 2)
t = t + 1
If a(m) = Key Then
Exit Do
ElseIf a(m) > Key Then
j = m - 1
Else
i = m + 1
End If
Loop
数组元素a(1)到a(8)的值依次为“2,11,14,15,18,19,25,32”,该程序段运行结束后,变量t的最大值可能是( )
For i = 1 To n - 1
For j=____________
If a(j) < a(j - 1) Then
t=a(j):a(j)=a(j-1):a(j-1)=t
End If
Next j
Next i
为了使此程序段能实现数组a中的数据升序排列,则划线处应填入的代码是( )
Const n = 6
Dim a(1 To n) As Integer, f(1 To 10) As Boolean
Dim tmp As Integer, i As Integer, j As Integer, t As Integer
′f数组各元素的初值置为False,代码略
For i = 1 To
t = Int(1 + Rnd * 10)
If Not f(t) Then
a(i) = t : f(t) = True
For j =
If a(j)<a(j-1) Then
tmp=a(j):a(j)=a(j-1):a(j-1)=tmp
End If
Next j
Else
End If
Next i
上述程序段3个方框处的表达式分别为( )
场景:主界面 |
类别序号:1 |
进入方式:直接进入 |
呈现方式: ⒈“国学启蒙”四字显示在舞台左上方 ⒉“弟子规”、“三字经”、“百家姓”三个按钮出现在舞台中间 ⒊背景音乐、弟子规、三字经、百家姓四段音频分别添加在“诵读”图层第1、26、27、28帧 ⒋背景从头至尾呈现,动画播放至最后自动停止 |
呈现顺序说明: ⒈一开始出现背景、飞鸟,背景音乐,并依次出现“国学启蒙”四个字 ⒉2秒后出现“弟子规”、“三字经”、“百家姓”按钮并停止动画播放,分别单击“弟子规”、“三字经”、“百家姓”三个按钮,仅播放本场景第26帧、27帧、28帧中对应应的弟子规、三字经、百家姓音频 |
表a
图b
实现上述功能的VB程序如下。
Private Sub Command1_Click()
Dim s As String, i As Integer, j As Integer, s1 As String
Dim a(30) As Integer, max As Integer, c As String, sum As Integer
s=Text1.Text
i=1:t=0:sum=0
Do While i <= Len(s)
c=Mid(s, i, 1)
If c=“,” Or ① Then
a(t)=a(t)+1
t=0
sum=sum+1
Else
′改错
End If
i=i+1
Loop
max=a(1)
For i=1 To 30
List1.AddItem “编号为”+Str(i)+ “的教师,得票数为”+Str(a(i))
If max < a(i) Then
max=a(i)
s1=“最高教师编号为:”+Str(i)
②
s1=s1+”,”+Str(i)
End If
Next i
Text2.Text=Str(sum)
Text3.Text=Str(max)
Label2.Caption=s1
End Sub
① ②
1)将该字符的ASCII码转换成对应的2位十六进制数;
2)将产生的十六进制数互换位置;
3)步骤2)产生的二位十六进制数即为该明文字符加密后的密文字符。
小明按照上述方法,设计了一个字符串加密的VB程序,功能如下:单击“生成密文”按钮Command1,程序依次将文本框Text1中每个字符按上述规则进行加密处理,连接这些加密字符,最后在文本框Text2中输出加密结果。程序运行界面如图所示。
实现上述功能的VB程序如下:
Private Sub Command2_Click()
Dim s As String, a As String, ans As String
Dim c As Integer, i As Integer
Dim s1 As String
s=Text1.Text
ans=” ”
For i=1 To Len(s)
a=Mid(s, i, 1)
s1=
ans=
Next i
Text2.Text=ans
End Sub
Function DToh(x As Integer) As String
Dim str As String
str=”0123456789ABCDEF”
Do While x <> 0
t=x Mod 16
x=x \16
Loop
End Function