Output file with ofstream
#include <iostream> #include <fstream> using namespace std; int main() { ofstream pout("test"); if(!pout) { cout << "Cannot open file.\n"; return 1; } pout << "A 444 555-4444\n"; pout << "B 222 555-2222\n"; pout << "Joe 333 555-1111\n"; pout.close(); return 0; }