麻豆一区区三三四区产品麻豆-麻豆影视国产TV在线观看-麻豆影视国产在线观看-麻豆影视在线-麻豆影视在线观看av-麻豆影院

我的工控
不積跬步,無以至千里,不積小流,無以成江海。
級別: 略有小成
精華主題: 0
發帖數量: 115 個
工控威望: 287 點
下載積分: 424 分
在線時間: 53(小時)
注冊時間: 2010-12-20
最后登錄: 2024-09-14
查看我的工控的 主題 / 回貼
樓主  發表于: 2010-12-21 21:23
用途:將十進制轉化為二進制
輸入:Dec(十進制數)
輸入數據類型:Long
輸出:DEC_to_BIN(二進制數)
輸出數據類型:String
輸入的最大數為2147483647,輸出最大數為1111111111111111111111111111111(31個1)Public DEC_to_BIN(Dec As Long) As String
    DEC_to_BIN = ""
    Do While Dec > 0
        DEC_to_BIN = Dec Mod 2 & DEC_to_BIN
        Dec = Dec \ 2
    Loop
End 用途:將二進制轉化為十進制
輸入:Bin(二進制數)
輸入數據類型:String
輸出:BIN_to_DEC(十進制數)
輸出數據類型:Long
輸入的最大數為1111111111111111111111111111111(31個1),輸出最大數為2147483647Public BIN_to_DEC(ByVal Bin As String) As Long
    Dim i As Long
    For i = 1 To Len(Bin)
        BIN_to_DEC = BIN_to_DEC * 2 + Val(Mid(Bin, i, 1))
    Next i
End 用途:將十六進制轉化為二進制
輸入:Hex(十六進制數)
輸入數據類型:String
輸出:HEX_to_BIN(二進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符 Public HEX_to_BIN(ByVal Hex As String) As String
    Dim i As Long
    Dim B As String
    
    Hex = UCase(Hex)
    For i = 1 To Len(Hex)
        Select Case Mid(Hex, i, 1)
            Case "0": B = B & "0000"
            Case "1": B = B & "0001"
            Case "2": B = B & "0010"
            Case "3": B = B & "0011"
            Case "4": B = B & "0100"
            Case "5": B = B & "0101"
            Case "6": B = B & "0110"
            Case "7": B = B & "0111"
            Case "8": B = B & "1000"
            Case "9": B = B & "1001"
            Case "A": B = B & "1010"
            Case "B": B = B & "1011"
            Case "C": B = B & "1100"
            Case "D": B = B & "1101"
            Case "E": B = B & "1110"
            Case "F": B = B & "1111"
        End Select
    Next i
    While Left(B, 1) = "0"
        B = Right(B, Len(B) - 1)
    Wend
    HEX_to_BIN = B
End 用途:將二進制轉化為十六進制
輸入:Bin(二進制數)
輸入數據類型:String
輸出:BIN_to_HEX(十六進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符   Public BIN_to_HEX(ByVal Bin As String) As String
    Dim i As Long
    Dim H As String
    If Len(Bin) Mod 4 <> 0 Then
        Bin = String(4 - Len(Bin) Mod 4, "0") & Bin
    End If
    
    For i = 1 To Len(Bin) Step 4
        Select Case Mid(Bin, i, 4)
            Case "0000": H = H & "0"
            Case "0001": H = H & "1"
            Case "0010": H = H & "2"
            Case "0011": H = H & "3"
            Case "0100": H = H & "4"
            Case "0101": H = H & "5"
            Case "0110": H = H & "6"
            Case "0111": H = H & "7"
            Case "1000": H = H & "8"
            Case "1001": H = H & "9"
            Case "1010": H = H & "A"
            Case "1011": H = H & "B"
            Case "1100": H = H & "C"
            Case "1101": H = H & "D"
            Case "1110": H = H & "E"
            Case "1111": H = H & "F"
        End Select
    Next i
    While Left(H, 1) = "0"
        H = Right(H, Len(H) - 1)
    Wend
    BIN_to_HEX = H
End 用途:將十六進制轉化為十進制
輸入:Hex(十六進制數)
輸入數據類型:String
輸出:HEX_to_DEC(十進制數)
輸出數據類型:Long
輸入的最大數為7FFFFFFF,輸出的最大數為2147483647Public HEX_to_DEC(ByVal Hex As String) As Long
    Dim i As Long
    Dim B As Long
    
    Hex = UCase(Hex)
    For i = 1 To Len(Hex)
        Select Case Mid(Hex, Len(Hex) - i + 1, 1)
            Case "0": B = B + 16 ^ (i - 1) * 0
            Case "1": B = B + 16 ^ (i - 1) * 1
            Case "2": B = B + 16 ^ (i - 1) * 2
            Case "3": B = B + 16 ^ (i - 1) * 3
            Case "4": B = B + 16 ^ (i - 1) * 4
            Case "5": B = B + 16 ^ (i - 1) * 5
            Case "6": B = B + 16 ^ (i - 1) * 6
            Case "7": B = B + 16 ^ (i - 1) * 7
            Case "8": B = B + 16 ^ (i - 1) * 8
            Case "9": B = B + 16 ^ (i - 1) * 9
            Case "A": B = B + 16 ^ (i - 1) * 10
            Case "B": B = B + 16 ^ (i - 1) * 11
            Case "C": B = B + 16 ^ (i - 1) * 12
            Case "D": B = B + 16 ^ (i - 1) * 13
            Case "E": B = B + 16 ^ (i - 1) * 14
            Case "F": B = B + 16 ^ (i - 1) * 15
        End Select
    Next i
    HEX_to_DEC = B
End 用途:將十進制轉化為十六進制
輸入:Dec(十進制數)
輸入數據類型:Long
輸出:DEC_to_HEX(十六進制數)
輸出數據類型:String
輸入的最大數為2147483647,輸出最大數為7FFFFFFFPublic DEC_to_HEX(Dec As Long) As String
    Dim a As String
    DEC_to_HEX = ""
    Do While Dec > 0
        a = CStr(Dec Mod 16)
        Select Case a
            Case "10": a = "A"
            Case "11": a = "B"
            Case "12": a = "C"
            Case "13": a = "D"
            Case "14": a = "E"
            Case "15": a = "F"
        End Select
        DEC_to_HEX = a & DEC_to_HEX
        Dec = Dec \ 16
    Loop
End 用途:將十進制轉化為八進制
輸入:Dec(十進制數)
輸入數據類型:Long
輸出:DEC_to_OCT(八進制數)
輸出數據類型:String
輸入的最大數為2147483647,輸出最大數為17777777777   Public DEC_to_OCT(Dec As Long) As String
    DEC_to_OCT = ""
    Do While Dec > 0
        DEC_to_OCT = Dec Mod 8 & DEC_to_OCT
        Dec = Dec \ 8
    Loop
End 用途:將八進制轉化為十進制
輸入:Oct(八進制數)
輸入數據類型:String
輸出:OCT_to_DEC(十進制數)
輸出數據類型:Long
輸入的最大數為17777777777,輸出的最大數為2147483647Public OCT_to_DEC(ByVal Oct As String) As Long
    Dim i As Long
    Dim B As Long
    
    For i = 1 To Len(Oct)
        Select Case Mid(Oct, Len(Oct) - i + 1, 1)
            Case "0": B = B + 8 ^ (i - 1) * 0
            Case "1": B = B + 8 ^ (i - 1) * 1
            Case "2": B = B + 8 ^ (i - 1) * 2
            Case "3": B = B + 8 ^ (i - 1) * 3
            Case "4": B = B + 8 ^ (i - 1) * 4
            Case "5": B = B + 8 ^ (i - 1) * 5
            Case "6": B = B + 8 ^ (i - 1) * 6
            Case "7": B = B + 8 ^ (i - 1) * 7
        End Select
    Next i
    OCT_to_DEC = B
End 用途:將二進制轉化為八進制
輸入:Bin(二進制數)
輸入數據類型:String
輸出:BIN_to_OCT(八進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符Public BIN_to_OCT(ByVal Bin As String) As String
    Dim i As Long
    Dim H As String
    If Len(Bin) Mod 3 <> 0 Then
        Bin = String(3 - Len(Bin) Mod 3, "0") & Bin
    End If
    
    For i = 1 To Len(Bin) Step 3
        Select Case Mid(Bin, i, 3)
            Case "000": H = H & "0"
            Case "001": H = H & "1"
            Case "010": H = H & "2"
            Case "011": H = H & "3"
            Case "100": H = H & "4"
            Case "101": H = H & "5"
            Case "110": H = H & "6"
            Case "111": H = H & "7"
        End Select
    Next i
    While Left(H, 1) = "0"
        H = Right(H, Len(H) - 1)
    Wend
    BIN_to_OCT = H
End 用途:將八進制轉化為二進制
輸入:Oct(八進制數)
輸入數據類型:String
輸出:OCT_to_BIN(二進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符 Public OCT_to_BIN(ByVal Oct As String) As String
    Dim i As Long
    Dim B As String
    
    For i = 1 To Len(Oct)
        Select Case Mid(Oct, i, 1)
            Case "0": B = B & "000"
            Case "1": B = B & "001"
            Case "2": B = B & "010"
            Case "3": B = B & "011"
            Case "4": B = B & "100"
            Case "5": B = B & "101"
            Case "6": B = B & "110"
            Case "7": B = B & "111"
        End Select
    Next i
    While Left(B, 1) = "0"
        B = Right(B, Len(B) - 1)
    Wend
    OCT_to_BIN = B
End 用途:將八進制轉化為十六進制
輸入:Oct(八進制數)
輸入數據類型:String
輸出:OCT_to_HEX(十六進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符Public OCT_to_HEX(ByVal Oct As String) As String
    Dim Bin As String
    Bin = OCT_to_BIN(Oct)
    OCT_to_HEX = BIN_to_HEX(Bin)
End 用途:將十六進制轉化為八進制
輸入:Hex(十六進制數)
輸入數據類型:String
輸出:HEX_to_OCT(八進制數)
輸出數據類型:String
輸入的最大數為2147483647個字符Public HEX_to_OCT(ByVal Hex As String) As String
    Dim Bin As String
    Hex = UCase(Hex)
    Bin = HEX_to_BIN(Hex)
    HEX_to_OCT = BIN_to_OCT(Bin)
End
VB自帶函數:
十進制轉八進制:Oct(num)
十六進制轉八進制:oct("&H" & num)
十進制轉十六進制:hex(num)
八進制轉十六進制:hex("&O" & num)十六進制轉換為十進制
    Dim str As String                    
    str = Text2.Text
    Text10.Text = CLng("&H" & str)
這無盡的雨絲,有沒有勾起你的回憶?對你來說,也許我不再重要。但只要你能記得我,我就已經無比欣慰。知道這雨讓我想起了什么嗎?你的眼淚。一滴滴的,晶瑩如珠,包裹著過去歲月的沙粒,在我的心頭滾動。
子丑寅卯9
好鋼是煉出來的; 好妞是泡出來的!
級別: 網絡英雄
精華主題: 0
發帖數量: 1223 個
工控威望: 6798 點
下載積分: 9012 分
在線時間: 335(小時)
注冊時間: 2008-05-17
最后登錄: 2024-07-10
查看子丑寅卯9的 主題 / 回貼
1樓  發表于: 2011-01-08 15:39
不錯,學習了。
(沈陽)承接非標自動化設計,調試及改造;各種通信控制;伺服調試,定位同步控制及專機制造。手機&微信同步(來訪注明家園):18680531562 。

主站蜘蛛池模板: 中文字幕日韩欧美一区二区三区| 91精品啪国产在线观看免费牛牛 | 日日摸夜夜添夜夜添A片一Y| 国产熟女真实乱精品91| 精品久久蜜臀AV色欲| 人妻免费久久久久久久了| 99欧美午夜一区二区福利视频| 制服丝袜国产中文精品| 精品久久久久香蕉网| 日本高清不卡一区久久精品| 亚洲国产精品一区二区第一页| 国产亚洲另类综合| 天堂网天堂手机版| 免费无码又爽又刺激高潮| a级毛片毛片免费观看久| 给我个可以免费看片的| 精品无码麻豆一区| 亚洲无码黄色免费网址| 亚洲午夜精品A片久久WWW软件| 久久久精品区二区三区| 国产麻豆久久| 日韩欧美国产另类婷久久| 国产超薄肉丝袜在线播放| 把女人弄爽特黄A大片片| 美国毛片免费一级久久99国产精品一区二区| 成人导航网| AV国産精品毛片一区二区网站| 精品伦理熟女国产一区二区| 国产激情在线视频| 日韩成人激情| 成人区精品一区二区不卡av免费| 国产极品JK白丝喷白浆免费视频| 精品水蜜桃| 日本黄页网站免费| 人妻精品一区二区三区99不卡| 91精品酒色国产综合久久| 亚洲av成人在线网站| 成人高清视频在线观看| 一卡2卡3卡4卡乱码在线| 国产三级做爰在线播放| 高清欧美性狂猛bbbbbbx|