/*-------
Signature: main: void -> int
Purpose: to read each line in the file
looky.txt in the current directory,
and print it on its own line
Examples: if looky.txt is empty,
running this program does nothing.
if looky.txt happens to contain:
Now is the time
for all good Doges
to come to the aid of their bacon!
then this will print to the screen:
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 input_file = "looky.txt";
// create an input stream and connect
// it to looky.txt
ifstream in_stream;
in_stream.open(input_file.c_str());
if (in_stream.fail())
{
cout << "there is NO file looky.txt!"
<< endl;
return EXIT_FAILURE;
}
string next_line;
getline(in_stream, next_line);
while (in_stream.eof() == false)
{
cout << next_line << endl;
getline(in_stream, next_line);
}
// close your input stream when done
in_stream.close();
return EXIT_SUCCESS;
}