July 20th, 2004, 11:32 AM
Fair enough, if you are using loads of for loops you may need a few counters, but I would worry when you've got so many embedded for loops. It might be ok, but hrrm.
And btw -- ...
July 20th, 2004, 12:47 AM
Hey man, I told you about the meaningful variable names thing. I refuse to help you with your code until you change the variables from a,b,c, etc. into something more englishlike that I can track...
July 19th, 2004, 11:43 AM
Just for your interest, here's a program I wrote last night to convert decimal to binary. It lets you specify the number of bits that you want to use (that's kinda pointless really, but I felt like...
July 19th, 2004, 01:17 AM
The first thing that I notice is your while loop condition. While I couldn't really say that it's not correct, it is possible that it could cause your program to go through more calculations than it...
July 18th, 2004, 08:27 PM
No, I was attempting to illustrate why you would need the three parameters. Namely because for some cases it would be impossible to tell which of the three the original number was and for all cases...
July 17th, 2004, 11:35 PM
lepricaun, you would need three vars because you need to know what base the original number is in (or I suspect you do). The following example should illustrate it for you:
What base is 10 in?
...
July 16th, 2004, 09:52 PM
I assume you know of the switch statement? :) Basically simple hex (as in 0 - 255 I believe) is made up of 2 characters. The first is multiplied by 16, then the second is added. So if you only have...
July 16th, 2004, 11:57 AM
The modulus operator is also handy for other conversions such as hex. Because hex is base 16 (I hope I'm right on that :)) you just modulus and divide by 16 instead of by 2. It's a slightly different...
July 15th, 2004, 11:44 PM
If you mod a number by two until you cannot do so anymore you will get the binary equivalent of it.
Modding (or modulusing) a number is where you get the remainder given when you divide it by...