int aa = 30; stringstream ss; ss<<aa; string s1 = ss.str(); cout<<s1<<endl; // 30 string s2; ss>>s2; cout<<s2<<endl; // 30
string s = "17"; stringstream ss; ss<<s; int i; ss>>i; cout<<i<<endl; // 17