CODE
Form 1
Private Sub Command1_Click()
Dim dec As Integer, d As Integer, i As Integer
Dim b As Long
dec = 0
i=0
b = Val(Text1.Text)
While (b > 0)
d = b Mod 10
dec = dec + d * 2 ^ i
i=i+1
b = b / 10
Wend
Text2.Text = dec
End Sub
Private Sub Command2_Click()
Dim n, a, i As Integer
Dim b(100) As Integer
n = Val(Text2.Text)
While (n <> 0)
b(i) = n Mod 2
n=n/2
i=i+1
Wend
For i = i - 1 To 0 Step -1
Text1.Text = Text1.Text & b(i)
Next
End Sub
Private Sub Command3_Click()
Dim oct, o, i As Integer
Dim b As Long
oct = 0
i=0
b = Val(Text1.Text)
While (b > 0)
o = b Mod 10
oct = oct + o * 8 ^ i
i=i+1
b = b / 10
Wend
Text3.Text = oct
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command5_Click()
End
End Sub
0 comments:
Post a Comment