Programming Challenge Numbers to Text?
Steve
smorrey at gmail.com
Tue May 2 05:54:32 MDT 2006
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 something that should have been tackled
ages ago and is probably a part of some entry level C++ courses, but
the only way I can think of doing it would be one helaciously long
switch statement. Fortunately this would only need to cover the
numbers 0 to 100.
It does need to be done in C/C++ though.
Any recommendations on a good lib for something like this, or an
example snippet that doesn't result in a 100+ line switch statement?
Thanks in advance.
(BTW the numbers are already stored in a stringor actually a const char*)
More information about the PLUG
mailing list