# How to Spell out numbers?

• 10-21-2009, 05:51 AM
syntrax
How to Spell out numbers?
I've been trying, this entire weekend on how to make a program that reads number inputed by a user, from 0.00 to 999.99... and i just can't figure it out!!!!! i know it seems easy but i swear, i just can't, everything i try just dont work. I'm not asking for a program that already works (tho very much appreciated :p) but just point me out in the correct direction.

I tried converting the numbers in to Chars, then using the ASCII table to assign them to letters and then use if else statements and that just doesn't work... help!:confused:

ty very much.
• 10-21-2009, 05:58 AM
Fubarable
It's always best for you to show us your best attempt at solving this first. This way, we can work with you with your code, and we can see what assumptions you are making that need correcting. Also, when posting code, please use code tags (see below), and please describe in as much detail as necessary how the program doesn't work right.

Much luck!
• 10-21-2009, 06:12 AM
[RaIdEn]
you can use scanner for reading user input right?
• 10-21-2009, 04:34 PM
jefrazie
An approach i would use would be to import each number as a string, then tokenize that string. Compare each value that was tokenized to another string containing the "word" representation of numbers.
• 10-22-2009, 03:31 PM
Lizzip
EDIT: Accidental double post :/ Don't know how to delete it, sorry
• 10-22-2009, 03:34 PM
Lizzip
I think you're over-complicating it.

Firstly make 3 arrays, one for hundreds, one for tens and one for ones.
So in array one, it has numbers such as one, two, three etc
Array tens has numbers such as ten, twenty, thirty and so on

Take the user's inputted number (say, 192.53) then separate numbers before and the numbers after into two seperate strings ("192" and "53"). Then seperate these into individual strings for each number. Then use some sort of string compare combined with which array it falls into to figure out which number you should write out.