此函数从给定流中读取数据,
直至遇到文件结束标识时停止,
他将读取的数据打印在标准输出上,
完成这些之后,
在返回流之前对其进行复位,
使其处于有效状态.
istream& ReadWordsFormConsole (istream & input)
{
string word;
vectorwords;
while (input >> word || !input.eofbit) {
if (input.bad ())
cout << ("IO stream corrupted");
if (input.fail ()) {
cerr << "Data failed try again" << endl;
input.clear (istream::goodbit);
continue;
}
words.push_back (word);
}
for (const string & each_word : words)
cout << each_word << endl;
input.clear ();
return input;
}
istream& ReadWordsFormConsole (istream & input)
{
}