填空题
[说明] 编写程序,把从键盘上输入的一批整数(以-1作为终止输入的标志)保存到文本文件“a: xxk1. dat”中。
{{U}} (1) {{/U}}
# include <fstream. h >
# include < stdlib. h >
void main ( ) {
{{U}} (2) {{/U}}
if ( ! four) {
cerr < <“文件没有找开!” < <end1;
exit (1);
}
int x;
cin > >x;
while({{U}} (3) {{/U}}){
{{U}} (4) {{/U}}
cin> >x;
}
{{U}}(5) {{/U}}
}
【正确答案】
1、{{*HTML*}}# include < iostream. h >
【答案解析】
ofstream four(" a: xxk1, dat" );
x! =
-1
fout < fout.
close( );