练习3.17 cin 死循环

作者: maaayz87创建于 2024年7月17日更新于 2024年7月17日

While (cin >> s) { words.push_back(s); } After pressing Enter, these words are written to the vector, but the loop does not exit. My method is: While (cin >> s && s != "end") { words.push_back(s); } Then proceed to the next step. Is there a problem with my understanding? The original problem cannot be run.

内容来源: applenob/Cpp_Primer_Practice