Cpp_Primer_Practice
Cpp_Primer_Practice copied to clipboard
练习3.17 cin死循环
while (cin >> s) {
words.push_back(s);
}
敲击多个空格分割的单词回车后,这些单词都被写入了vector,但循环出不来。 我的方法: while (cin >> s && s!=“end”) { words.push_back(s); }再进行下步操作
是我的理解有问题吗,原题解运行不了。
题解代码换行没用,要手敲\n才能出循环