作业帮 > 综合 > 作业

What happens when a C++ input stream enters the fail state?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/26 02:18:43
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