# Numbers to Letters

• 09-22-2003
flip114
Numbers to Letters
Can somebody tell me or give me help, point me in the right direction, on how i would take and an amount like \$1452.34 and automatically print out "One Thousand Four hundred Fifty Two Dollars and Thirty Four Cents." I was thinking this would require alot of "if/else" statements, but how would i identify the different numbers and there position in the amount like thousands, hundreds and millions.

Thanks for all the help, much appreciated. :)
• 09-22-2003
RussMan
Yes it would require a little bit of indirect seperating but first you need to convert the value to a string to pull it apart. One function that will do that is _itoa() it takes an integer and converts it to a string. Then you can rip the string apart to determine what is in it.
• 09-22-2003
twm
I remember seeing several threads along these lines while searching the forums. Methinks you should get into the searching habit as well, you'll save yourself having to wait for a response to a new thread.
• 09-23-2003
WaltP
Quote:

Originally posted by twm
I remember seeing several threads along these lines while searching the forums.
Yes, there have been quite a few threads on this topic. The difference this time is the addition of the decimal point. Be careful with some of the code though, be sure to read the complete thread.
• 09-23-2003
twm
>The difference this time is the addition of the decimal point.
I don't see much difference, you're working with two strings instead of one and the delimiter between the two is a period character. No biggie.
• 09-24-2003
WaltP
Quote:

Originally posted by twm
>The difference this time is the addition of the decimal point.
I don't see much difference, you're working with two strings instead of one and the delimiter between the two is a period character. No biggie.

Didn't say it was a biggie, just a slight difference.