#include<iostream>
#include<sstream>
#include<string>
using namespace std;
int main()
{
//istringstream istr;
//istr.str("vfvjbj vdfx7");
////上述两个过程可以简单写成 istringstream istr("1 56.7");
//cout << istr.str() << endl;
//string a;
//string b;
//istr >> a;
//cout << a << endl;
//istr >> b;
//cout << b << endl;
//ostringstream ostr;
//ostr.str("abcmmmm");//如果构造的时候设置了字符串参数,那么增长操作的时候不会从结 尾开始增加,而是修改原有数据,超出的部分增长
//ostr.put('d');
//ostr.put('e');
//ostr << "fg";
//string gstr = ostr.str();
//cout << gstr<<endl;
//stringstream ostr("ccccccc kfgdgfdlk");
//ostr.put('d');
//ostr.put('e');
//ostr << "fg";
//string gstr = ostr.str();
//cout << gstr << endl;
//string a;
//ostr >> a;
//cout << a<<endl;
stringstream ss;
ss << "hello world ";
string s = ss.str();
cout <<s<< endl;
system("pause");
return 0;
}
sstream的用法
猜你喜欢
转载自blog.csdn.net/SenPaul/article/details/82721193
今日推荐
周排行