Streamstring的使用
istringstream对象可以绑定一行字符串,然后以空格为分隔符把该行分隔开来。#include<iostream>#include<sstream>using namespace std;int main(){string str, line;while(getline(cin, line)){istringstream stream(line);while(stream>>str)cout<<str.c_str()<<endl;}return 0;}