stringstream can swallow different types and then spit out different types.
This can realize the conversion of int, string, double and other types
1 #include<sstream> 2 3 using namespace std; 4 5 int main() 6 { 7 int x; 8 stringstream temp; 9 temp << x; // swallow the converted type 10 string s1 = temp .str( ); // spit out the required type 11 } 12