Bootstrap

OJ:stringstream实现int型与string型的相互转化

#include<iostream>
#include<sstream>
using namespace std;
int main(){
	stringstream ss;
	string str="22222";
	int a=100;
	ss << a;
	ss >> str;
	cout << str << endl;
	cout << a << endl;
	ss.clear();//单个重复使用时,每次使用后需clear

	str="22222";
	a=100;
	ss << str;
	ss >> a;
	cout << str << endl;
	cout << a << endl;
	ss.clear();

	return 0;
}
;