c++中的数据类型转换问题,急!!
在一个字符串中,例如string str="1 2 1 5 4 3 7 6 10 9 8";我怎么将字符串str中的10提取出来,并且转化成int类型的!!#include <iostream> #include <string> int main() { std::string str("1 2 3 4 5 6 7 8 9 10 11"); int a = atoi(&str[18]); std::cout<<a<<std::endl; return 0; }