vb6专家吧 关注:4贴子:22
  • 0回复贴,共1

【原】二进制转八进制vb6程序

只看楼主收藏回复

Private Sub Command1_Click()
Dim strN As String, strOct As String, strBin(), iOct As String
Dim intXh As Integer, i As Integer, j As Integer, strTmp As String
strBin = Array("000", "001", "010", "011", _
"100", "101", "110", "111")
strN = InputBox("", "", "111000111")
If Len(strN) Mod 3 <> 0 Then strN = String(3 - Len(strN) Mod 3, "0") & strN
intXh = Len(strN) \ 3
For i = 1 To intXh
strTmp = Right(strN, 3)
For j = 0 To 7
If strTmp = strBin(j) Then
iOct = j & iOct
Exit For
End If
Next
strN = Left(strN, Len(strN) - 3)
Next
MsgBox "O" & iOct
End Sub


IP属地:河北1楼2013-06-26 08:11回复