BBS: Inland Empire Archive Date: 03-19-92 (14:31) Number: 144 From: RICK PEDLEY Refer#: NONE To: KEVIN NEWELL Recvd: NO Subj: Number Conversions Conf: (2) Quik_Bas
On 03-16-92 KEVIN NEWELL wrote to All... KN> I am looking for a quickie and easy way to convert decimal KN> to base 36 I have seen some code in the past, but I can not KN> find it... 'From any base to any base 'Nibble Magazine, 86/07 page 127 DEFINT A-Z Start: N = 0 INPUT "From Base, To Base, Number: ", A, B, N$ FOR M = 1 TO LEN(N$) C = ASC(MID$(N$, M, 1)) - 48 N = N * A - (C > 9) * (C - 7) - (C < 10) * C NEXT M C = 0: N$ = "" FOR M = 1 TO 0 STEP -1 C = C + 1 D! = N / B ^ C + .0001 M = INT(D!) R = INT((D! - M) * B) N$ = CHR$(-(R < 10) * (R + 48) - (R > 9) * (R + 55)) + N$ NEXT M PRINT N$ GOTO Start ... OFFLINE 1.36 * Moving fast is not the same as going somewhere. --- Maximus 2.01wb * Origin: The BULLpen BBS * Intel 14.4EX (613)549-5168 (1:249/140)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET