string到int的转换
string result=”10000”;
int n=0;
stream<<result;
string result=”10000”;
int n=0;
stream<<result;
stream>>n;//n等于10000
int到string转换
#include <string>
#include <sstream>
#include <iostream>
int main()
{
std::stringstream stream;
std::string result;
int i = 1000;
stream << i; //将int输入流
stream >> result; //从stream中抽取前面插入的int值
std::cout << result << std::endl; // print the string "1000"
}