⑴将字符的ASCII码值加20(十进制);
⑵以字节为单位进行加密处理;
⑶将1个字节的8位二进制数左移一位,最低位用左移出的最高位填充;
⑷将处理后的8位二进制数分割成前4位与后4位两个二进制数;
⑸分别将上述两个4位二进制数转换为十六进制数;
⑹所得两个十六进制数码交换顺序后连接,即为该字节的密文。
用UltraEdit-32软件观察“i-hangzhou”这几个字符的内码,如图所示,则字符H加密后的密文是( )
将该按钮元件应用于舞台,下列描述正确的是( )
n = 10
Text1.Text = ""
For i = 1 To 5
For j = n To i + 1 Step -1
If a(j) < a(i) Then
temp = a(j): a(j) = a(i): a(i) = temp
End If
Next j
Next i
For i = 1 To 10
Text1.Text = Text1.Text + Str(a(i))
Next i
数组元素a(1)到a(10)的值依次为“965,155,195,444,106,734,172,983,898,360”,执行该程序段,文本框Text1中显示的是( )
Dim i As Integer, Sum As Integer
Dim a(1 To 11) As Integer
Sum = 6
a(11) = 49
For i = 10 To 1 Step -1
a(i) = a(i + 1) - 1
If a(i) Mod 3 = 0 Then Sum = Sum + a(i)
Next i
Text1.Text = Str(Sum)
该程序段运行后,文本框text1中显示的内容是( )
(计算公式:上旬价格与上旬平均价格之差=上旬价格-上旬平均价格)
图b
Private Sub Command1_Click()
Timer1.Enabled = '
End Sub
Private Sub Timer1_Timer()
Dim s As String, c As String
Dim a As Integer, e As Integer, h As Integer
Randomize
s = ""
For a = 1 To 30
e = Int(Rnd() * 52 + 1)
If e <= 26 Then
h = e + 64
Else
h = '
End If
c = '
s = s + c
Next a
List1.AddItem s
End Sub
图a
图b
实现上述功能的VB程序如下,但横线处代码有错,请改正。
Private Sub Command1_Click()
Dim a As String
Dim x As Integer, s As Integer, k As Integer
a = Text1.Text
x = 1: s = 0: k = 0
For i = 1 To Len(a)
'如果输入的不是0到9的数字或者空格,则给出错误提示后结束子程序
If (Asc(Mid(a, i, 1)) < 48 Or Asc(Mid(a, i,1)) > 57) or(Asc(Mid(a,i,1))= 32) then’Label1.Caption = "只能输入数字或空格"
Exit Sub
End If
If Mid(a, i, 1) = " " Then
s = s + Mid(a,x,i)’
x = i + 1
k = k + 1
End If
Next i
Label1.Caption = "这" + Str(k) + "个数的和为:" + Str(s)
End Sub
实现上述功能的VB程序如下,请回答下列问题:
Dim a(1 To 100) As String '数组大小满足处理要求,学生学号
Dim b(1 To 100) As String '数组大小满足处理要求,学生姓名
Dim i As Integer '学生总数
Dim j As Integer
Dim dd(1 To 100) As Integer
Private Sub Form_Load()
‘从数据库读取全班同学的相关信息,存储在数组a、数组b和变量i中
Dim n As Integer
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\1718.accdb"
conn.Open
Set rs.ActiveConnection = conn
strSQL = "SELECT * FROM stuinfo"
rs.Open strSQL
'本过程的其他语句略
End Sub
Private Sub Command1_Click()
Dim ShuruNum As Integer, k As Integer, y As Integer,n As Integer
Randomize
ShuruNum = Val(Text1.Text)
Label4.Caption = ""
For k = 1 To i
dd(k) = 0
Next k
If ShuruNum > 0 And ShuruNum <= i Then
j = 1
Do While j <= ShuruNum
y = Int(Rnd() * i) + 1
If Then'
dd(j) = y
j = j + 1
End If
Loop
List2.Clear
For n = 1 To ShuruNum
List2.AddItem '
Next n
Else
Label4.Caption = "错误:没有输入中奖人数或超过学生总数"
End If
End Sub
'核对重复,避免同一人再次中奖
Private Function CheckCF(p As Integer) As Boolean
Dim m As Integer,x As Boolean
x = True '初始化
For m = 1 To j
If Then '
x = False
Exit For
End If
Next m
CheckCF = x
End Function