>From: Aaron Guy Davies <agd12 at columbia.edu>
>Reply-To: chat at freenetproject.org
>To: chat at freenetproject.org
>Subject: Re: [freenet-chat] Numconv
>Date: Sun, 31 Mar 2002 03:09:02 -0500 (EST)

>This is a terrible way to do it. Does QBasic support the modulus operator,
>commonly written as "mod" (in Pascal) or '%' (in C-style languages), where
>"x % y" returns the remainder when x is divided by y?

I don't know of one.  QBasic is pretty basic in it's commands and operators. 
  I've tried writing a QBasic program that does this, but I just can't get 
it right.  I first start out by determining if the Decimal number is Even or 
ODD, that way I already know that the last character in the Binary 
conversion will either be a 1 or a 0.  Then if the DEC number is ODD, I 
simply remove 1 from it to make it even, then perform an operation on that 
even number to try to determine the largest subtractable number in Binary, 
then I subract that number, adding a 1 to the binary number, and try again 
to find the highest subractable number, and so on, until I finaly reach the 
smallest subractable number in binary and get done with the calculation.  
What I'm haveing trouble with is keeping track of the 1s and 0s in binary.  
This QBasic language is really giving me a headache, but its the only 
language I know.

As for the XL spreadsheet, MAN was that easy to create. :)  It may not be an 
APPLICATION writen in C++ or Java or something, but it gets the job done 
VERY easily both on the computer, and on paper. :)

>I've had to write
>arbitrary base conversion programs that simply use the modulus and
>exponentiation in a loop to do the conversion. The idea is something like
>this:

I don't understand how you would use the remainder for anything.  In basic 
the remainder isn't seperate from the rest of the number, and a number with 
a remainder is very hard to work with, mathematicaly.  So I'd rather just 
eliminate the remainder, or ODDness of the number. :)

>
>while (number greater than zero) {
>       find current digit
>       subtract current digit value from number
>       increment a counter
>}

I use a counter in my QBasic file, incrementing until the number it 
generates is larger than the number to be converted, or the remaining amount 
to be converted, then going back a step to the previous incremement, 
subtracting THAT incremented number from the number to be converted and 
adding a 1 to the binary number and changing the number to be worked on to 
find out the Next highest possible subtractable number, and so on.  I'm just 
having difficulty telling it how many 0s to put between the 1s.  GRRR!!!

>
>It will take you several tries to get this right, but it can be used for
>any conversion you like.

I don't understand C or C++ or Java yet.  And the manuals are too alien to 
me right now.  So I'll have to wait till I get into a Class that teaches it. 
:)

How about one of you volunteer to download and look at my work, instead of 
speculating about it.  That would be much better I think.

Here, I'll just pick someone and random and send the files to em.  How about 
that? :>

Krepta.

_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


_______________________________________________
Chat mailing list
Chat at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/chat

Reply via email to