1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream> #include <sstream> using namespace std; int main() { string s; stringstream tmp; s = "1-th word, second word ect."; tmp << s; while (tmp >> s) { cout << s << endl; } }
1 2 3 4 5
1-th word, second word ect.