#include
#include
using namespace std;
int main()
{
ofstream fout("test.dat");
if(!fout) {
cout << "Cannot open file.\n";
return 1;
}
fout << 10 << " " << -20 << " " << 30.2 << "\n";
fout << "This is a test.";
fout.close();
if(!fout.good()) {
cout << "A file error occurred.";
return 1;
}
}