草了个DJ,怎么一直记不住这个啊!
#include#include using namespace std; int main(){ string str; getline(cin, str); string x; stringstream ss(str); while(ss >> x){ cout << x << endl; } }
也可以这样:
#include#include using namespace std; int main () { vector strVector; string tmp; while(cin>>tmp){ strVector.push_back(tmp); if(cin.get()=='n'){ // do something } } }



