mohamed
unread,Sep 19, 2011, 4:54:59 PM9/19/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Building Skills Books
Check Amount Writing.
Translate a number into the English phrase.
This example algorithm fragment is only to get you started. This shows
how to pick off the digits from
the right end of a number and assemble a resulting string from the
left end of the string.
Note that the right-most two digits have special names, requiring some
additional cases above and
beyond the simplistic loop shown below. For example, 291 is “two
hundred ninety one”, where 29 is
“twenty nine”. The word for “2” changes, depending on the context.
As a practical matter, you should analyze the number by taking off
three digits at a time, the expression
‘(number % 1000)’ does this. You would then format the three digit
number with words like “million”,
“thousand”, etc.