
-----------------------------------
yodu123
Thu Mar 19, 2009 12:16 am

decimal to binary conversion
-----------------------------------
i just start using Turing. i never used any programing language before and i kinda need some tips on how i can made a conversion from decimals to binary....and also how i can take a number from a textbox (GUI.createtextbox) to be converted into binary digit... appreciate ur help :)

-----------------------------------
syntax_error
Thu Mar 19, 2009 12:29 am

RE:decimal to binary conversion
-----------------------------------
If you can avoid using the turing GUI at all costs.

Secondly as to your first problem, how would you convert a base 10 number into a base 2 using a pen and paper if you are unaware, and to save me time from typing read the following: http://math.about.com/od/calculuslessons/a/changebase.htm 

Google is your friend for further investigation.

-----------------------------------
yodu123
Thu Mar 19, 2009 9:32 am

RE:decimal to binary conversion
-----------------------------------
i know how to do it on a paper but i have to make a program which converts in order to make a calculator

-----------------------------------
Insectoid
Thu Mar 19, 2009 10:06 am

RE:decimal to binary conversion
-----------------------------------
Use math in a for loop. Not that div does division with the decimal cut off, and mod does the remainder after division.

-----------------------------------
DemonWasp
Thu Mar 19, 2009 10:12 am

RE:decimal to binary conversion
-----------------------------------
If you know how to do it on paper, you should be able to convert that to a working program. If not, try and tell us what you're getting confused with.

-----------------------------------
copthesaint
Fri Mar 20, 2009 4:56 pm

RE:decimal to binary conversion
-----------------------------------
Binary is pretty simple for finding numbers
exapmle 0011 0011 = 51 how do I know this?

the following is a crappy version of a binary table
128 64 32 16 8 4 2 1 - 8bit
-------------------------
0    0    1    1    0   0   1   1 -binary number
ok so really it's simple for every number thats one add the binary number on the table.
1+2+16+32 = 51 not hard right?

now if you have a number bigger then 128, this would get more complicated but