7,762
社区成员
发帖
与我相关
我的任务
分享
Debug.Print IIf((Value And &H80)<>0, "正常","错误")
Function BinByte(ByVal Value As Byte) As String
Dim s As String
Dim i As Long
Dim n As Byte
n = Value
s = Space$(8)
For i = 8 To 1 Step -1
Mid$(s, i, 1) = CStr(n Mod 2)
n = n \ 2
Next
BinByte = s
End Function
'打印为1的位置
Dim str As String
Dim btmp() As Byte
Dim i As Long
str = "10001111"
btmp = str
For i = 0 To UBound(btmp) Step 2
If Chr(btmp(i)) Then
Debug.Print CStr(i / 2 + 1) & "-" & Chr(btmp(i))
End If
Next
Dim b As Integer, s As String, i As Integer
b = &H8F
For i = 7 To 0 Step -1
s = s & (b And 2 ^ i) / 2 ^ i
Next i
Print s
Private Sub Command1_Click()
Dim b As Integer, s As String, i As Integer
b = 143
For i = 1 To 8
b = b * 2
If b >= 256 Then
b = b - 256
s = s & "1"
Else
s = s & "0"
End If
Next
Print s
End Sub