/* Lecture code 1.0
 *
 * A program to open a file, then print out all words that aren't integers.
 * To run this program, you'll need to have a file named datafile.dat in the
 * working directory.
 */

#include <iostream>
#include <fstream> // For ifstream
#include <string>  // These next two lines replace genlib.h
using namespace std;

int main()
{
	ifstream input("datafile.dat");
	/* Should do error checking here! */
	
	while(true)
	{
		/* Try to read an int. */
		int myInt;
		input >> myInt;
		
		/* Check for end-of-file, break if necessary. */
		if(input.eof())
			break;
		
		/* If we fail, read it as a string. */
		if(input.fail())
		{
			input.clear();
			string word;
			input >> word;
			cout << word << " ";
		}
	}
	
	return 0;
}