#include <iostream> #include <string> #include <sstream> using namespace std; int main() { string word; string line; while (getline(cin,line)) { istringstream istr(line); while(istr>>word) cout<<word<<"#"; cout<<endl; } return 0; }
注释:上述的两个操作,相当于在输入流中加入了eof操作