题型:综合题 题类:常考题 难易度:普通
浙江省白云中学2018-2019学年高一下学期信息技术3月月考试卷
图1
图2
图3
Private Sub Command1_Click()
Dim zysj As Single, zyfy As Single ‘zysj:租用时间,zyfy:租用费用
zysj = Val(Text1.Text)
If zysj <= 60 Then
zyfy = 0
ElseIf zysj <= 120 Then
zyfy = 1
ElseIf zysj <= 180 Then
ElseIf zysj Mod 60 = 0 Then
zyfy = (zysj - 180) / 60 * 3 + 3
Else
zyfy = (Int((zysj - 180) / 60) + 1) * 3 + 3
End If
Label5.Caption = Str(zyfy)
End Sub
①将该字符的ASCII码值转化为8位二进制数;
②将后4位二进制数进行按位取反(1变0,0变1);
③将操作②生成的4位二进制数均左移1位(原第1位变为新的第4位);
④原高4位二进制数连接到新的后4位二进制数成为最终加密后字符的内码。
例如:字符“a”经过上述加密运算,可得到字符“m”。
ASCII码值 |
转二进制 |
后四位取反 |
后四位左移 |
拼合 |
转十进制 |
转字符 |
97D |
01100001B |
1110 |
1101 |
01101101B |
109D |
“m” |
程序运行界面如图所示,请改正加框处有误的代码:
Private Sub Command1_Click()
Dim s As String:Dim sl As String:Dim jg As String
Dim n As Integer:Dim x As Integer:Dim i As Integer:Dim j As Integer
Dim a(15)As String
a(0)=“0000”:a(1)=“0001”:a(2)=“0010”:a(3)=“0011”
a(4)=“0100”:a(5)=“0101”:a(6)=“0110”:a(7)=“0111¨
a(8)=“1000”:a(9)=“1001”:a(10)=“1010”:a(11)=“1011¨
a(12)=“1100”:a(13)=“1101”:a(14)“1110”:a(15)=“1111”
jg=“ ”
s=Text1.Text
For i=1 To Len(s)
n=Asc(Mid(s,i,1))
low=n Mod 16
low=15-low ‘执行步骤②
s1=Mid(a(low),2,3)&Mid(a(low),1,1) ‘执行步骤③
For i=l To 4
x=x+Val(Mid(s1,j,1))* ‘⑴{#blank#}1{#/blank#}
Next j
x= *16+x ‘⑵{#blank#}2{#/blank#}
jg=jg&Chr(x)
Next i
Text2.Text=jg
End Sub
试题篮