#include #include //for class ofstream #include //for EXIT_SUCCESS and EXIT_FAILURE using namespace std; //This C++ program creates an output file named outfile.txt //in the current directory. void f(); //The function declaration announces the name of the function. int main() { f(); return EXIT_SUCCESS; } void f() //The function definition creates the function. { ofstream outfile {"outfile.txt"}; //The constructor opens the file. outfile << "Hello.\n"; //Use outfile like cout. outfile << "Goodbye.\n"; } //The destructor closes the file.