(转)stringstream类的使用(实现string类型与其余类型的转化)

转自论坛帖子 http://topic.csdn.net/u/20100412/16/2a9a0c15-63e7-4bd5-8019-6c3959540adf.html

 

C/C++ code #include <iostream> #include <string> #include<sstream> using namespace std; int main() { string s="123"; stringstream st; int a; st<<s; st>>a; cout<<a<<endl; system("pause"); return 0; } 

你可能感兴趣的:(c,String,2010)