Decimal to Binary Converer

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 5
Reputation: nse2008 is an unknown quantity at this point 
Solved Threads: 0
nse2008 nse2008 is offline Offline
Newbie Poster

Decimal to Binary Converer

 
0
  #1
Apr 20th, 2008
Hi everyone , i am trying to fully uderstand the recursion method in vb but i still have problems in making the programs work, Can anyone help me to create a program that convert decimal numbers to binary numbers or point me to the right direction,I know that this can be done by continuing dividing by 2 until the is no more result left but in a recursive method i have problems. Thank you
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 5
Reputation: nse2008 is an unknown quantity at this point 
Solved Threads: 0
nse2008 nse2008 is offline Offline
Newbie Poster

Re: Decimal to Binary Converer

 
0
  #2
Apr 21st, 2008
Hi i found this code on the web that works but can someone tell my how does this works


Private Function RecursionFunc(ByRef AsciiNum As Short, ByRef SubNum As Short) As Object

If AsciiNum - SubNum > 0 Then
txtNew.Text = txtNew.Text & 1 'Add a 1 to indicate that it contains a subnum in it
If SubNum <> 1 Then 'Check to make sure it's not 1
RecursionFunc(AsciiNum - SubNum, SubNum / 2) 'Call myself with the new asciinum and subnum
End If
Else
txtNew.Text = txtNew.Text & 0 'Add a zero to indicate that the subnum is not contained
If SubNum <> 1 Then 'Check to make sure it's not 1
'Call myself with the same asciinum because it does not contain a subnum and make subnum the next smallest
RecursionFunc(AsciiNum, SubNum / 2)
End If
End If
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Decimal to Binary Converer

 
0
  #3
Apr 21st, 2008
Hi i found this code on the web that works but can someone tell my how does this works
u said it works but you want to someone tell u how it works?confusing statement.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 5
Reputation: nse2008 is an unknown quantity at this point 
Solved Threads: 0
nse2008 nse2008 is offline Offline
Newbie Poster

Re: Decimal to Binary Converer

 
0
  #4
Apr 21st, 2008
yes how does this code works
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC