⑴以1个字节为单位进行处理
⑵高位段(左边4位)左移一位,最低位用左移出的最位高填充,低位段(右边4位)右移一位,最高位用右移出的最低位填充
⑶分别将上述两段二进制转换为十六进制,所得两位十六进制依次连接即为密文则字符“H”的密文是( )
Dim strA As String, strB As String
strA = "hongda":strB = ""
For i = 1 To Len(strA) * 2
If i / 2 = Int(i / 2) Then
strB = strB + Chr(Asc(Mid(strA, (i - 1) Mod Len(strA) + 1, 1)) + 2)
End If
Next i
该程序段运行后,变量strB的值是( )
Function fact(n As Integer) As String
If n = 1 Then
fact = fact & 1
Else
fact = fact(n \ 2) & n Mod 2
End If
End Function
Private Sub Command1_Click()
Dim x As String, i As Integer, r As Integer
x = Text1.Text
For i = 1 To Len(Text1.Text)
If Mid(x, i, 1) = "." Then Exit For Next i
r = Val(Mid(x, i + 1, Len(Text1.Text) - i)) Text2.Text = fact(r)
End Sub
在文本框Text1中输入2019.70,则执行程序段,在文本框Text2中显示的内容是( )
c = 1: s = 10
Do While c <= s
For i = s To c + 1 Step -1
If Then
t = a(i - 1): a(i - 1) = a(i): a(i) = t
End If
Next i
For i=
If Then
t = a(i + 1): a(i + 1) = a(i): a(i) = t
End If
Next i
c = c + 1
s = s - 1
Loop
上述程序段三个方框处的语句分别为( )
Private Sub Command1_Click() ‘列表框中输出 b(i),代码略
End Sub
Private Sub Form_Load()
conn.ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;DATASource="& App.Path & "\GDP2018.accdb" conn.Open:Set myrecord.ActiveConnection = conn:myrecord.Open "GDP"
n = 0
Do While Not myrecord.EOF n = n + 1
a(n) = myrecord.Fields("2018")
b(n) = Left(myrecord.Fields("Area"), 5) & " " & myrecord.Fields("2018") myrecord.MoveNext
Loop
conn.Close: myrecord.Close: Set myrecord = Nothing: Set conn = Nothing End Sub
下列说法不正确的是( )
图 b
图 b
将动画GIF文件“白鸽.gif”导入库中直接得到一个影片剪辑元件,则该元件中动画的动画类型是。(单选,填字母, A .形状补间动画/ B .动画补间动画/ C .逐帧动画)
图 c
依据上述描述设计如下VB程序:
Dim xh(1 To 100) As Integer , xm(1 To 100) As String, cj(1 To 100) As Integer Dim n As Integer, m As Integer
Private Sub Form_Load()
'本过程从数据库依次读取n位同学的序号、姓名及成绩,然后按成绩降序排序,将学生序号、姓名成绩存储在数组xh、xm、cj中,结果显示在List1中,
End Sub
'显示每位同学的位置 Private Sub Command1_Click() Dim wz As String m=Val(Text1.Text) For i = 1 To n \ m For j = 1 To m If ① Then wz = wz + xm((i - 1) * m + j) + " " Else wz=xm((i-1) * m + j)+" "+wz End If Next j List2.AddItem wz wz =" " Next i If n Mod m <> 0 Then For i= To n ‘加框处改错 wz = wz + xm(i) + " " Next i List2.AddItem wz End If End Sub |
'显示每位同学的位置编号 Private Sub Command2_Click() Dim zu As Integer Dim ha As String, hb As String List3.AddItem "序号" & vbTab & "姓名" & vbTab & "位置" 'vbTab 用于字符对齐 For i = 1 To n zu = ② ha = Trim(str(zu)) If Len(ha) = 1 Then ha = "0" + ha If zu Mod 2 = 0 And zu <= n \ m Then hb = ③ Else hb = Str(i - m * (zu - 1)) End If hb = Trim(str(hb)) 'Trim 函数功能是去除字符空格 If Len(hb) = 1 Then hb = "0" + hb List3.AddItem str(i) & vbTab & xm(i) & vbTab+ ha + hb Next i End Sub |
请回答下列问题:
① ② ③
寻求路径最大值的算法设计如下:
按三角形的行划分,若有n行,则有n-1个步骤
①从底层开始,本身数即为最大值
②倒数第二层的计算取决于底层的数据:
12+6=18,13+14=27,24+15=39,24+8=32;
③倒数第三层的计算取决于底二层的数据:
27+12=39,39+7=46,39+26=65;
④倒数第四层的计算取决于底三层的数据:
46+11=57,65+8=73;
④最后的路径:13—8—26—15—24其和为86。
根据上述算法描述,设计程序界面如下图所示,点击“生成金字塔”按钮,在列表框中生成数字金字塔,点击“寻求路径最大值”按钮,在文本框text1中输出最大值。
依据上述描述设计如下VB程序:
Const n = 5
Dim sx As String
Dim i, j, k, a(1 To 100) As Integer Private Sub Command1_Click() List1.Clear
For i = 1 To n For j = 1 To i
①
sx = sx + Str(a((i - 1) * n + j)) Next j
For k = n To i Step -1 sx = " " + sx
Next k List1.AddItem sx sx = ""
Next i End Sub
Private Sub Command2_Click() For i = n To 1 Step -1
For j = 2 To i
If ② Then
a((i - 2) * n + j - 1) = a((i - 1) * n + j - 1) + a((i - 2) * n + j - 1)
Else
a((i - 2) * n + j - 1) = a((i - 1) * n + j) + a((i - 2) * n + j - 1)
End If Next j
Next i
③
End Sub
请回答下列问题:
① ② ③