VB中怎么十进制转换二进制了!,这道题怎么编写代码? 15
1个回答
展开全部
Dim A10 As Integer,N As Integer
Dim An As String
Private Sub Command1_Click()
Dim C As String,A As Integer,A1 As Integer
A10=Val(Text1)
A=A10
N=Val(Text2)
Text4=Text2
An=“”
do
A1=A Mod N
A=A\N
C=Chenge(A1)
An=An & C
Loop While A>0
Text3=An
End Sub
Function Chenge(I As Integer) As String
If I<10 Then
Chenge=Str(I)
Else
I=I-10
Chenge=Chr(Asc(“A”)+I)
End If
End Function
Dim An As String
Private Sub Command1_Click()
Dim C As String,A As Integer,A1 As Integer
A10=Val(Text1)
A=A10
N=Val(Text2)
Text4=Text2
An=“”
do
A1=A Mod N
A=A\N
C=Chenge(A1)
An=An & C
Loop While A>0
Text3=An
End Sub
Function Chenge(I As Integer) As String
If I<10 Then
Chenge=Str(I)
Else
I=I-10
Chenge=Chr(Asc(“A”)+I)
End If
End Function
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询