c++ number conversionCommunity Forums/General Help/c++ number conversion
I'm currently learning c++ and trying to make a program as simple as possible to convert int numbers into words e.g. 568 = five hundred and sixty eight, but only problem is i'm not to sure of how to go about getting
1: it to be as short as possible
2: how to get it word values above 19, 100 ect
can anyone help with advice and possible code samples?
| There is a post in the code archives that does this, I believe... |
| Store the Strings in an array.|
Use a for loop incremented by 100, the a seperate one by 10, and then by one.
for i=0 to 100 i=i+99 if number > i print strings-hundreds(i) next ... repeat with 10s
| Here is the code archive function to do it in Blitzmax...|
You should be able to take the logic and do it in c++.
| thanks :) should be able to work it out from the code and advice. |