Page 1 of 1

Someone can helpme and tell me that this program works well

Posted: Mon Aug 18, 2008 2:53 pm
by lrcvs
Deleted!!!

Posted: Mon Aug 18, 2008 7:53 pm
by Mentat
Worked fine for me. What inputs didn't work?

Posted: Mon Aug 18, 2008 10:41 pm
by Ralph
burgr77: Try 5 decimal to binary.

Luis: ?Tal vez ser?a bueno limitar las bases a base16? Cambi? la ?ltima parte de su c?digo ?:
Luis: It might be a good idea to limit this to base 16? I changed the last part of your code to:

Code: Select all

'De base 10 lo transformamos a la base destino
DO
  d# = a# MOD basdes
  IF d# > 10 THEN
    d$ = CHR$(55 + d#)
  ELSE
    d$ = LTRIM$(STR$(d#))
  END IF
  a1$ = d$ + a1$
  a# = a# \ basdes
LOOP UNTIL a# = 0
PRINT a1$
SYSTEM

Posted: Tue Aug 19, 2008 2:08 am
by lrcvs
Deleted!!!

Posted: Tue Aug 19, 2008 2:57 am
by burger2227
The following Function converts any decimal Integer number (decnum&) to any base number (CBase%) up to 10 as a string number. Can be adapted to handle string entry parameters also with VAL.

Code: Select all

FUNCTION Dec2Base$(decnum&, CBase%)

DO
remain% = decnum& MOD CBase%       'remainder sets next digit
decnum& = decnum& \ CBase%         'discard any remainder with integer division
Rnum$ = LTRIM$(STR$(remain%))      'make base string number from remainder
Dec2Base$ = Rnum$ + Dec2Base$      'add remainder to base number
LOOP UNTIL decnum& = 0

END FUNCTION
Base numbers above 10 require Letter designations!

Ted

Deleted !!!

Posted: Tue Aug 19, 2008 4:48 am
by lrcvs
Deleted !!!

Posted: Tue Aug 19, 2008 9:26 am
by sid6.7
its fine here...thanks