[Gambas-user] binary numeral system

vlahonick vlahonick tsopanotragi at ...67...
Tue Apr 14 11:21:34 CEST 2009


hello all :D

i am trying to create a program that calculates a number from the binary numeral system and gives a result

example of what the program will do :

we have the number (at binary numeral system) 10011

so to have result we have to do (1*2^4)+(0*2^3)+(0*2^2)+(1*2^1)+(1*2^0)=
16+0+0+2+1=19

to do that in a program first i have to calculate the powers
so i have to write (y=number of digits) for the first of the digits y-1,second y-2etc

so if i have 5 digits then the power for the first one will be y-1=5-1=4

this is done by the Len(textbox1.text)

but HOW i will write Len(textbox1.text)=y ?????

then how i can make the program to recognize that for the 1st digit entered in the Textbox1.text have to
give (d*2^y-1) (d=the digit that can be 0 or 1 and y the number of the digits) for the second (d*2^y-2)etc...

so the main question is how i can make JUST ONE TEXTBOX to understand that for every digits enter it will give something else for a result

sorry about my english but it has been long time since i had english lessons...
plz if u dont understand something let me know and i will try to explain better...
if you want to contact me directly :tsopanotragi at ...67... | vlahonick at ...2136...6... | chris at ...2135...

thanks in advance Vlahonick (all the truth is always in www.vlahonick.freehost.gr)

_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx


More information about the User mailing list