Re: New Thread Single items to number for Edit "Box" Solved

new topic     » goto parent     » topic index » view thread      » older message » newer message
Selgor said...

Hello Lonny

I have attached your code below

If I enter 4 in decimal number

I get 1'a' instead of 10
and maybe 1|' instead of 10

So what is wrong ??

 
 while n1 != 0 do 
       	seq = prepend(seq, remainder(n1,2)) 
	n1 = floor(n1/2) 
 end while 
-- move 2 lines below after the end while 
 seq += 48 
 setText(EditText2, sprintf("%s", {seq})) 
 

Cheers

Selgor

Hi Selgor,

Try moving the 2 lines as shown. What is happening is that you are adding the 48 to the 1st bit three times, to the 2nd bit twice and the 3rd bit once. If you move it below the 'end while' it will only be added once to each bit.

Lonny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu