字符串处理之字符串流的创建

来源:互联网 发布:百度网盘会员充值淘宝 编辑:程序博客网 时间:2024/04/29 11:56
<span style="font-size:18px;">#include <cstdio>#include <cstdlib>#include <iostream>#include <stack>#include <queue>#include <algorithm>#include <cstring>#include <cmath>#include <vector>#include <bitset>#include <list>#include <sstream>using namespace std;#define INT_MAX 1 << 30typedef long long ll;int n;int main(int argc, char const* argv[]){    string a,b;    while (getline(cin,a))      //读一行数据    {//        int d;        stringstream c(a);      //用此行创建一个字符串流        while (c >> b)          //读入每个行中字符串        {            cout << b << endl;  //输出每个字符串        }                       //这个while可以实现对整数的输入输出        cout << c.str();        //输出流//        while (c >> d)//        {//            cout << d << endl;//        }    }    return 0;}</span>

0 0
原创粉丝点击