Programming Challenge Numbers to Text?

2006-05-02 Thread Steve
Hello all, This is prolly a little offtopic, but I'm wondering if anyone can recommend a good quick method of converting numbers to text. For instance if I wanted to replace all instances of 100 with the words One Hundred, is there something already written, a library somewhere? This seems like

Re: Programming Challenge Numbers to Text?

2006-05-02 Thread Walter Holladay
The easiest way would be to simply create an array with all the numbers as words, and then just use the number as an index into the array. Like so: int main() { const char* nums[10]={Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine}; int i; for (i=0; i 10; i++)

Re: Programming Challenge Numbers to Text?

2006-05-02 Thread Steve
Yeah thats nice but then you have a 100 unit array, seems to me it could probably be done in less than 30 lines if I can work out how to handle place value in C On 5/2/06, Walter Holladay [EMAIL PROTECTED] wrote: The easiest way would be to simply create an array with all the numbers as words,

Re: Programming Challenge Numbers to Text?

2006-05-02 Thread Stephen Smith
Here is a simple pair of functions that will do the trick. This is in Oracle's PL/SQL but should be readily readable by most programmers. The VARCHAR2 data type is simply a string. The || operator is the concatenation operator, and text strings are enclosed in '. The first function,

Re: Programming Challenge Numbers to Text?

2006-05-02 Thread Walter Holladay
OK, how about this? #include stdio.h int main() { const char* singles[20]={Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen}; const char*

Re: Programming Challenge Numbers to Text?

2006-05-02 Thread Steve
Hey now thats an elegant solution. I'm just surprised there isn't a library somewhere with this or something like it. On 5/2/06, Walter Holladay [EMAIL PROTECTED] wrote: OK, how about this? #include stdio.h int main() { const char*

Re: [OT] Need feedback from current iProvo MSTAR users

2006-05-02 Thread Roberto Mello
On Mon, May 01, 2006 at 01:39:31PM -0600, Steve wrote: I had initial problems with MStar but am generally happy with them now, but then again I'm on Utopia fiber not iProvo which I guess are different things. That seems to be a pattern (had problems in the beginning, but now things are ok). I

Re: [OT] Need feedback from current iProvo MSTAR users

2006-05-02 Thread Steve
You know thats really odd, because when I signed up for MStar it was because of the bundling (alot better than comcasts deal anyways) but when I said I wanted a little faster than they could provide, they said I could get my internet through Xmission and still get other services through them. On