帮忙看一下C++中创建文件的问题
#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ios;
#include <fstream>
using std::ofstream;
#include <stdlib.h>
int main()
{
ofstream outClientFile( "clients.dat", ios::out );
if ( !outClientFile )
{
cerr << "File could not be opened" << endl;
exit( 1 );
}
cout << "Enter the account, name, and balance." << endl
<< "Enter end-of-file to end input.\n? ";
int account;
char name[ 30 ];
double balance;
while ( cin >> account >> name >> balance )
{
outClientFile << account << ' ' << name << ' ' << balance << endl;
cout << "? ";
}
return 0;
}
这是一段创建文件clients.dat的程序,运行以后怎么把输入的内容创建成一个文件的形式呢?