I\'m new to C++. I\'m sorry if this question is duplicated but I just can\'t find similar question.
very basic code:
string s; while (cin >> s)
You can signal EOF via CTRL-D or CTRL-Z.
Or, you can check for a particular string to break the loop, like below:
string s; while (cin >> s) { if(s == "end") break; cout << s << endl; }