The night of my last reply, I went home and wrote a function which accomplished the task in about 300 lines of code. I am happy to report that, no longer being a newbie, it took me one hour to write it! Though it does contain some bugs, it otherwise works well.
I'll explain a little of how I approached it:
-First, if the input is a string, erase all whitespace.
-Find the length of the string. This will tell you right away the range of the number.
-Start backwards. That is, assemble the output string starting with the largest values.
-Use strcat frequently!
There will be several tricky manipulations. For instance, when you are processing, say, the "tens" place, you might need to do something like:
case '9': strcat(output, "Ninety ");
///continue down the line
ones_place_flag = 0; /* <--- make sure we don't get a string that ends up like : " Eighteen Eight Dollars" !!! */
case '9': strcat(output, "Nineteen ");
// continue on down
...So that when you get to the ones place, you can use the "ones_place flag":
if(ones_place_flag != 0)
case '9': strcat(ouput, "Nine ");
/// And so on...
You will probably use several of these types of flags....
Anyway, I hope that helped some. Let me know how it goes...