帮忙给选择题改错

来源:百度知道 编辑:UC知道 时间:2024/05/28 05:03:48
What happens when a C++ input stream enters the fail state?
a. The system displays an error message, and program execution is terminated.
b. The system displays an error message, the program continues running, and further input operations with that stream are ignored.
c. The system does not display an error message, and program execution is terminated.
d. The system does not display an error message, the program continues running, and further input operations with that stream are ignored.
e. none of the above

我选的是B,结果错了,求正解

d.
你看下面的程序
while( cin>>str )
do ...
就是一直读入字符串到str,直到文件流状态为错,但既没有输出错误,也不会终止。应该选D