题型:综合题 题类:常考题 难易度:困难
浙江省温州新力量联盟2020-2021学年高二下学期信息技术期中联考试卷
1)对待加密的字符进行判断,如果是英文字符的,则将该字符后移2位(如:字符“A”转换成“C”,字符“Z”转换成“B”,字符“a”转换成“c”,字符“z”转换成“b”),其他字符保持不变;
2)求出每个字符的ASCII码,然后用7位二进制来表示,比如“4”的ASCII码为十进制52,转换为7位二进制为“0110100”;
3)从左至右依次记为第1,2,3……7位,分别把第3,4,5位取反。即0变1,1变0,至此“0110100”变为“0101000”,将此二进制转换为ASCII码为40,对应的字符为左括号“(”,即“4”经过加密后得到加密字符为左括号“(”。
在文本框Text1中输入ASCII字符,单击“加密”按钮Command1,则在文本框Text2中显示经过加密的字符。程序界面如图所示,请完成下列问题。
Private Sub Command1_Click()
Dim s As String, ch As String s = Text1.Text
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "A" And ch <= "Z" Then
ElseIf ch >= "a" And ch <= "z" Then '让小写字母后移2位,代码略
End If
Text2.Text = Text2.Text +
Next i
End Sub
Function jm(x As String) As String
Dim a(1 To 7) As Integer, j As Integer, n As Integer, asc1 As Integer
asc1 = Asc(x)
n = 0
For j = 7 To 1 Step -1
If j = 3 Or j = 4 Or j = 5 Then a(j) = 1 - asc1 Mod 2
Else
a(j) = asc1 Mod 2
End If
n =
asc1 = asc1 \ 2
Next j
jm = Chr(n)
End Function
试题篮