int、string、vector的转换


一、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());

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM