若想从第16帧开始不出现按钮,则下列操作不可行的是( )
For i=1 to 3
For j=6 to i+1 step -1
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(1)到a(6)的值依次为( )
i=1: j=6: n=0: f=False
key=val(Text1.Text)
Do while i<=j and f=False
n=n+1
m=(i+j)\2
If key=d(m) then f=True
If key<d(m) then j=m-1 Else i=m+1
Loop
数组元素d(1)到d(6)的值依次为“13,18,25,30,35,59”。文本框Text1中输入33后运行该程序,运行结束后下列说法不正确的是( )
图a
图b
Private Sub Com1Click()
Dim n As Integer, i As Integer, s As String
s = ""
For i = 1 To n
If i <= n \ 2 + 1 Then
s = s + Str(2 * i - 1)
Else
s = s +
End If
Next i
Text2.Text = s
End Sub
例如,压缩前的原始数据为:
1111 1100 0101 1010 1011 0000 可表示为十六进制:FC 5A B0
删除每字节的后2 bit:
1111 1100 0101 1010 1011 0000
首尾相连构建新的数据:
11 1111 0101 1010 1100 表示为十六进制:... F5 AC
自此,原数据进行了有损压缩。程序运行界面如下所示:
实现上述算法的VB程序如下,但程序中加框处有误,请改正。
Dim a(1 To 100) As Integer
Const code = "0123456789ABCDEF"
Const n = 100
Private Sub FormLoad()‘ 以随机数模拟读取原始数据
s = ""
Randomize
For i = 1 To n
a(i) = Int(Rnd * 16)
Text1.Text = Text1.Text + ①
Next i
End Sub
Private Sub Command1Click()
For i = 1 To n
t = t + HtoB(a(i))
Next i
For j = 1 To n * 4 Step 8'每8位一组,取前6个字符
s = s + Mid(t, j, 6)
Next j
For i = 1 To 4 * (n - 1) Step 4'每4位一组转为十六进制显示
Text2.Text = Text2.Text + BtoH(Mid(s, i, 4))
Next i
End Sub
Function HtoB(x As Integer) As String'十六进制转为二进制函数
t = ""
m = 0
Do While ②
r = x Mod 2
m = m + 1
t = Trim(r) + t'trim()用于删除前导空格
x = x \ 2
Loop
HtoB = Mid("0000", 1, 4 - m) + t
End Function
Function BtoH(y As String) As String'二进制转为十六进制函数
t1 = Val(Mid(y, 4, 1))
t2 = Val(Mid(y, 3, 1))
t3 = Val(Mid(y, 2, 1))
t4 = Val(Mid(y, 1, 1))
s = t1 + t2 * 2 + t3 * 4 + t4 * 8
BtoH = Mid(code, s + 1, 1)
End Function
① ②
图a
图b为标准ASCII码表供你参考(其中ASCII为1-32,127的字符为特殊符号,不能用作密码):
图b
实现上述功能的VB程序代码如下,请回答以下问题:
①H2?N64Aj ②[26wv9,Q ③$14G/uv ④zX}rb!T&}d2
Private Sub Command1Click()
Dim t As Integer
Dim a(1 To 4) As Integer
flag = True
n = 0
pwd = ""
Randomize
Do While flag
t = ' 随机生成33-126的ASCII码
pwd = pwd + Chr(t)
s = 0
For i = 1 To 4
s = s + a(i)
Next i
n = n + 1
If n >= 6 And s = 4 Then
Loop
Text1.Text = pwd
End Sub
‘ 获取字符类型:1-小写字母,2-大写字母,3-阿拉伯数字,4-符号
Function check(x As Integer) As Integer
If x >= 97 And x <= 122 Then
check = 1
ElseIf x >= 65 And x <= 90 Then
check = 2
ElseIf x >= 48 And x <= 57 Then
check = 3
Else
check = 4
End If
End Function