Hello
I have some trouble interpreting a string and I hope you can help me.
I have to convert a string, or a word in a number. Like five hundred fifty in 550. I dont know exactly how to do it.
I was thinking to try to analize each word, but this seems like a huge code. Or i was thinking that maybe you can check in a table, but then the table should be huge(numbers should go up to millions)
Is there a smarter way? What do you suggest?
Thank you very much
CD1
0
Newbie Poster
Recommended Answers
Jump to PostYou are right to assume that there will be some code to write but its not that much. If you are going from a five hundred and fifty to 550 needs 3 tables. If you can use the STL than using a map you would be a great way to …
Jump to Posthow are you getting the string in from the user? is it of type string or is it a c-style string i.e. char[]?
Jump to PostAlright. I would suggest using two arrays then. the first array would be of type char[][] and the second array would be of type int[]. the first array you would populate with all of the cases that you are going to encounter. start it with "one" then "two" and keep …
All 9 Replies
NathanOliver
429
Veteran Poster
Featured Poster
CD1
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
CD1
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
CD1
0
Newbie Poster
CD1
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
CD1
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.