C/C++: Reading and sorting a string.

Jun 24, 2013 at 7:33pm
closed account (4jNqM4Gy)
So I'm toying with a little idea and not entirely sure how to do it. An example of reading a file into a string is easy enough. But I got to wondering, what if I want to take each piece (delimited with a space) and place the pieces in different arrays? So if I were to have a string like this: 3421 hello 213.231 j2ki4 000010110, how could I take each of those pieces and put them in respective arrays (int, double, char) to store for some other processes to run? Is it possible to do that?
Jun 24, 2013 at 9:59pm
Well I don't see what can make it impossible, try using isdigit to check the string then from there you will be able to do your conversion. check the link below. Happy hunting☺

http://www.cplusplus.com/reference/cctype/isdigit/
Topic archived. No new replies allowed.