>From: Mark J Roberts <mjr at znex.org> >Reply-To: chat at freenetproject.org >To: chat at freenetproject.org >Subject: Re: [freenet-chat] Numconv >Date: Sun, 31 Mar 2002 02:10:05 -0600 > >krepta at juno.com: > > I don't understand C or C++ well enough to know what this source code > > means. Sorry. I need it in QBasic, at least till I learn C and C++. :) > > INPUT: hex, binary, octal, decimal, whatever > > || > \/ > > CONVERSION: native integer > > || > \/ > > OUTPUT: hex, binary, octal, decimal, whatever > >That's the broad structure of the conversion program. Now, the >specific algorithms - to create an integer from hex, for instance, >or print an integer in decimal format - are really common, so you'll >have no trouble finding example code and explanations. They require >bit-level manipulation (shifts, masks, etc) so you should be >comfortable with doing that sort of thing before diving in. > >There are actually only two algorithms for standard base-n numbers, >one for input and one for output. Things like roman numerals or >spelled-out numbers will require specialized algorithms, of course, >so it's a good idea to write your conversion program in an >extensible way, in case you ever need to deal with those. > >Unfortunately I don't know QBasic, but I'll show you how I'd >implement the program in C if you'd like (I'll write lots of >comments).
Sure, that would be great. :) I would understand the comments a lot better than the code. :) Maybe I could figure out a QBasic port by reading your comments. :) _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. _______________________________________________ Chat mailing list Chat at freenetproject.org http://lists.freenetproject.org/mailman/listinfo/chat