
Originally Posted by
Tesp
So, I spent some more time on it, and I'm still stumped.
What I tried this time:
- Try to think of an algorithm that can turn a number from 0 to a cap of 999,999,999 into english text, all without using string conversions. It would iterate through each number from zero to that cap, using some basic arithmetic operations. These operations would help fill a string array with the english translations of each iterated integer, each integer corresponding to its index in that array. However, the best I could think of was one that'd work for numbers from 0-999, which is far from my initial goal.
- Go back to my previous program, and manually trace the logic based on a sample input of 123. I had no idea how 123 was translated as "one hundred twenty three". I would have used the Code Blocks or Netbeans debugger, but for some reason, they dont let me see the contents of vectors. That is, except for the first element added. That annoyance pretty much rendered debuggers useless for this problem (I need to know how the contents got changed around!), hence why I had to manually trace the logic.
- I forgot to mention this when making the OP, but I did try using the debuggers before asking here for help. As the above point explains, they didn't really help.
So, yeah. Any other advice? I'll spend another couple of days on this, seeing if I can stumble upon some solution in the meantime.