7330.html

来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Re: 位元运算,请各位高手帮忙,谢谢</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 位元运算,请各位高手帮忙,谢谢</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:honey0@tcts1.seed.nett.tw">Honey</a> on November 13, 1998 at 23:16:09:<p>
In Reply to: <a href="7318.html">位元运算,请各位高手帮忙,谢谢</a> posted by 谢明宪 on November 13, 1998 at 10:54:26:<p>
提供你一段程式 能帮你将十进位的数转成二进位<br>在表单中加入Command1 Text1 Text2<br>Text1中输入十进位整数<p>Option Explicit<p>Private Sub Command1_Click()<br>Text2.Text = ch2bit(Text1.Text)<br>End Sub<p>Public Function ch2bit(s As String) As String<br>Dim i As Long, h As Long<br>Dim d, u<br>h = CLng(s)<br>i = 0<br>Do While 2 ^ i <= h<br>u = 2 ^ i<br>If u And h Then<br>ch2bit = "1" & ch2bit<br>Else<br>ch2bit = "0" & ch2bit<br>End If<br>i = i + 1<br>Loop<br>End Function<p>若想一BIT 一BIT传出<br>我想就只剩下字串的处理问题了<br>可用MID之类的函式 最后加点遮照就好了
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 7330-->
</ul><!--end: 7330-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?