主观

把从键盘上输入的一批整数(以-1作为终止输入的标志)保存到文本文件“a:xxk1.dat”中。

#include ﹤iostream﹥

#include ﹤fstream.h﹥

#include ﹤stdlib. h﹥

void main( )

{

ofstream fout("a: xxk1.dat");

if( _____________ )

 {

cout﹤﹤"文件没有打开!"﹤﹤end;

exit(1);

}

int x;cin﹥﹥x;

while(x! =-1)

{

fout ﹤﹤x﹤﹤' ';

cin ﹥﹥x;

}

_____________; //关闭文件

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服