ChristopherNoel
asked on
how to covert a numeric to a character string
i been doing a project about a user menu..
i wonder how to convert a numeric to a character string
er...sorry about that, wat i really want to ask is for example if i key in a numeric number 3 then the
output will be a character "three" anf if i key in 4 it will return a character string "four". i wondder
what string library should used..
i wonder how to convert a numeric to a character string
er...sorry about that, wat i really want to ask is for example if i key in a numeric number 3 then the
output will be a character "three" anf if i key in 4 it will return a character string "four". i wondder
what string library should used..
Not sure entirely what you mean. If you're asking how you can convert a number stored in an integer (e.g. 25343) to a printable string, then you're looking at sprintf() or _ltoa (the latter might possibly be compiler-specific, I'm not sure). If this ISN'T what you're asking I think you need to clarify the question.
ASKER
er...sorry about that, wat i really want to ask is for example if i key in a numeric number 3 then the output will be a character "three" anf if i key in 4 it will return a character string "four". i wondder what string library should used..
What is the range of numbers?
2 ChristopherNoel
What is the big problem. Let's create an arrays with text description and parse the number in the correct range.
{"zero","one","two",..,"ni ne"};
{"eleven", "twelve", "thirteen",..., "nineteen"}
{"ten","twenty",..."ninety "}
{"hundred", "thousand", "million"}
I think it is standard task for students.
What is the big problem. Let's create an arrays with text description and parse the number in the correct range.
{"zero","one","two",..,"ni
{"eleven", "twelve", "thirteen",..., "nineteen"}
{"ten","twenty",..."ninety
{"hundred", "thousand", "million"}
I think it is standard task for students.
Well, there isn't a standard library function to do what you want, so you'll have to write your own. AlexNek has pointed you along the right path, I suspect.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi ChristopherNoel
Please convert the above program...
....
....
....
char *a[5] = { " Hundred", " Thousand", " Lakhs", " Crore", " Arab" } ;
----------To---------
char *a[5] = { " Hundred", " Thousand", " Million", " Million", " Trillion" } ;
The above Numbering system we use in India... You can change to your country's format ..
Bye
Vasudeesha
Please convert the above program...
....
....
....
char *a[5] = { " Hundred", " Thousand", " Lakhs", " Crore", " Arab" } ;
----------To---------
char *a[5] = { " Hundred", " Thousand", " Million", " Million", " Trillion" } ;
The above Numbering system we use in India... You can change to your country's format ..
Bye
Vasudeesha
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Vasudeesha's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Kent (Kdo)
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Vasudeesha's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Kent (Kdo)
EE Cleanup Volunteer