int、string、vector<int>的转换

一、vector<int>转换成string

1 std::stringstream ss;
2 string testString;
3     std::reverse_copy(result.begin(),result.end(),ostream_iterator<int>(ss,""));
4 testString = ss.str();

二、string转换成int

string op;
int temp;
temp = atoi(op.substr(j,1).c_str());

 

posted on 2016-07-07 15:19  时间的女儿  阅读(3815)  评论(0编辑  收藏  举报

导航