Someone can helpme and tell me that this program works well

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Someone can helpme and tell me that this program works well

Post by lrcvs »

Deleted!!!
Last edited by lrcvs on Wed Apr 01, 2009 3:42 pm, edited 1 time in total.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

Worked fine for me. What inputs didn't work?
For any grievances posted above, I blame whoever is in charge . . .
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post 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
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Post by lrcvs »

Deleted!!!
Last edited by lrcvs on Wed Apr 01, 2009 3:43 pm, edited 1 time in total.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Deleted !!!

Post by lrcvs »

Deleted !!!
Last edited by lrcvs on Wed Apr 01, 2009 3:44 pm, edited 2 times in total.
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

its fine here...thanks
Post Reply