Computer Science Canada Im trying to get Base10 numbers to show as Base2 |
Author: | TokenHerbz [ Mon Jul 31, 2006 12:49 pm ] | ||
Post subject: | Im trying to get Base10 numbers to show as Base2 | ||
Here is my code: Needing help with >>>fcn base10_base2<<<
Note that the function base2_base10 seems to work fine, its the function base10_base2 i need help with.. I dont get where im going wrong with it. |
Author: | Cervantes [ Mon Jul 31, 2006 5:08 pm ] | ||
Post subject: | |||
This is basically what you did, except cleaned up. I got rid of the use of a flexible array. If you were going to use an array, have it be an array of boolean (true for 1, false for 0). Your function should return a string or something other than an integer, because integers are always in base10.
|
Author: | Delos [ Mon Jul 31, 2006 5:15 pm ] |
Post subject: | |
Just as a side note, there is a Turing fcn that accomplishes this. I won't mention it, since you're obviously learning more from recreating it. But, in case you were wondering.... |
Author: | TokenHerbz [ Mon Jul 31, 2006 5:33 pm ] |
Post subject: | |
alright thanks. |
Author: | Clayton [ Mon Jul 31, 2006 8:16 pm ] |
Post subject: | |
and what may I ask is this function? I'd like to know what it is to see what they did for it (if its not an external function ) |
Author: | Cervantes [ Mon Jul 31, 2006 8:39 pm ] |
Post subject: | |
It's a function to convert a decimal (base 10) number to a binary (base 2) number, as the name of the function pretty clearly shows, the commenting confirms, and the coding asserts beyond doubt. |
Author: | [Gandalf] [ Mon Jul 31, 2006 9:05 pm ] |
Post subject: | |
Cervantes, I'm quite sure he meant the Turing function Delos referred to, tut tut. The function is indeed not coded in Turing. It's purpose is not specifically to convert numbers to and from different bases, though it can. |
Author: | Cervantes [ Mon Jul 31, 2006 9:21 pm ] |
Post subject: | |
[Gandalf] wrote: Cervantes, I'm quite sure he meant the Turing function Delos referred to, tut tut.
Delos posted in this thread? Sorry, Delos, you're posts just do that to me. Sorry, SuperFreak82. Sorry, [Gandalf]. Sorry, Cervantes. |