A-A+

阅读以下说明和C++码 将应填入(n)处的字名写在对应栏内。 从下列的3道试题(试题五至试题

2022-08-05 22:28:42 问答库 阅读 172 次

问题详情

阅读以下说明和C++码,将应填入(n)处的字名写在对应栏内。
从下列的3道试题(试题五至试题七)中任选1道解答。
如果解答的试题数超过1道,则题号小的1道解答有效。
[说明] 编写程序,把从键盘上输入的一批整数(以-1作为终止输入的标志)保存到文本文件“a: xxk1. dat”中。
(1)
include <fstream. h >
include < stdlib. h >
void main () {
(2)
if (! four) {
cerr < <“文件没有找开!” < <end1;
exit (1);
}
int x;
cin > >x;
while((3)){
(4)
cin> >x;
}
(5)
}请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:# include < iostream. h >ofstream four(" a: xxk1 dat" );x! = -1fout < fout. close( );
# include < iostream. h >ofstream four(" a: xxk1, dat" );x! = -1fout < fout. close( );

考点:试题