cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Reading multi values from string
Reading multi values from string
Apr 30, 2011 at 11:13pm UTC
Faurax
(33)
1
2
3
4
5
6
string name_age_IQ; name_age_IQ = Lucas:37:13; string name;
int
age;
int
iq;
How do I import:
"Lucas" to string name,
"37" to int age,
and "13" to int IQ?
Last edited on
Apr 30, 2011 at 11:15pm UTC
Apr 30, 2011 at 11:35pm UTC
quirkyusername
(792)
std::string::substr
http://www.cplusplus.com/reference/string/string/substr/
will get you the part of the string you want, and here's a discussion about the best way to convert a string to an int
http://www.cplusplus.com/forum/articles/9645/
May 1, 2011 at 1:26am UTC
Faurax
(33)
Thanks!
Topic archived. No new replies allowed.