/*-------
Signature: main: void -> int
Purpose: to demonstrate file output
by writing a hard-coded message to
a file in the current directory
named looky.txt
Examples:
when this is run, it should have the
side effect of creating (or overwriting)
a file named looky.txt in the current
directory with the contents:
Now is the time
for all good Doges
to come to the aid of their bacon!
by: Sharon Tuttle
last modified: 2016-12-06
--------*/
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <fstream>
using namespace std;
int main()
{
cout << boolalpha;
string output_file = "looky.txt";
// create an output stream and open
// it to connect it to this file
ofstream out_stream;
out_stream.open(output_file.c_str());
// write to the output stream to write
// to the file it is connected to
out_stream << "Now is the time" << endl;
out_stream << "for all good Doges" << endl;
out_stream << "to come to the aid of "
<< "their bacon!" << endl;
// close the output stream when you are done
out_stream.close();
return EXIT_SUCCESS;
}