⑴原码就是二进制定点表示法,即最高位为符号位,“0”表示正,“1”表示负,其余位表示数值的大小;
⑵反码表示法规定:正数的反码与其原码相同;负数的反码是对其原码逐位取反,但符号位除外。如二进制原码10010,则反码11101(注:在10010中,左边的1为符号码,故为负);
⑶补码表示法规定:正数的补码与其原码相同;负数的补码是在其反码的末位加1,符号位除外。
根据以上运算规则,二进制有符号数100011的补码的十进制表示是( )
下列说法正确的是( )
Dim a As Integer, b As Integer, c As Integer, y As Integer
a=3:b=4:c=4
If a<=b And c<=a Then
y=a+b
ElseIf a<=b or b<=c Then
y=b+c
ElseIf b=c Then
y=a mod c
Else
y=a+b+c
End If
该程序段运行之后,变量y的值为( )
Dim n As Integer, s As Integer, i As Integer n=Val(Text1.Text) s=0 For i=1 To n Step 2 s=s+i Next i Text2.Text=Str(s) |
图1
Dim n As Integer, s As Integer, i As Integer n=Val(Text1.Text) s=0 i=1 Do While i<=n s=s+i i=i+2 Loop Text2.Text=Str(s) |
图2
当n的值为10时,关于该两段程序,下列说法不正确的是( )
Dim a(1 To 5) As Integer, i As Integer, c As Integer
a(1)=2:a(2)=1:a(3)=3:a(4)=4:a(5)=5
c=0
For i=3 To 5
If a(i-2)+a(i-1)=a(i) Then c=c+1
Next i
Text1.Text=Str(c)
该程序段运行后,文本框Text1中显示的内容是( )
Private Sub Form_Click( )
Dim x as Integer, n as Integer
x=1
n=0
Do While x < 20
n=n+1
x=x * 3
Loop
Text1.Text=Str(x)
Text2.Text=Str(n)
End Sub
Dim a(1 To 10) As Integer,i As Integer,j As Integer
a(1)=1
a(2)=1
For i=3 To 5
a(i)=1
For j=i-1 To 2 Step -1
a(j)=a(j)+a(j-1)
Next j
Next i
Text1.Text=Str(a(3))
该程序段运行后,在文本框Text1中显示的内容是( )
Private Sub Command1_Click()
Dim x1 As Integer,x2 As Integer,n As Integer
Dim sum As Long
x1=Val(Text1.Text)
x2=Val(Text2.Text)
Sum=0
If x1<x2 Then n=1 Else
For i=x1 To x2 Step n
IfThen
sum=sum+i
Next i
Label3.Caption=“从”& x1 &“到”& x2 &“之前所有奇数的累加和=”& Str(sum)
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, c As Integer,n As Long
c = 0
n = 110800 + i
If Then
List1.AddItem Str(n) + " " + "5"
End If
Next i
Label2.Caption = "满足条件的数有:" + Str(c) + "组"
End Sub
Private Sub Command1_Click()
Dim n As Integer, i As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
List1.Clear
n = Val(Text1.Text)
If n >= 100 And n <= 500 Then
For i = 1 To 9
A.位置一
a = n \ 100
b = (n - 100 * a) \ 10
c = n Mod 10
B.位置二
Next i
C.位置三
Else
List1.AddItem "输入数值有误"
End If
D.位置四
End Sub
解密规则:将整数中各个位中的每一位值乘以5,然后除以8所得余数即为该位的值,然后将所得数的首末位进行交换。如数字9357,解密后的值为3715。
Private Sub Decryp_Click( )
Dim zs As Long, g As Integer
Dim b As Integer, q As Integer
Dim m As Integer, s As Integer
Dim jmh As String
zs = Val(Text1.Text)
For m = zs To
q = (m \ 1000) * 5 Mod 8
b = ((m \ 100) Mod 10) * 5 Mod 8
s = ((m \ 10) Mod 10) * 5 Mod 8
g = (m Mod 10) * 5 Mod 8
List1.AddItem Str(m) + " " + jmh
Next m
End Sub