/* Program 6.1.2 from C++ Programming Lecture notes  */

/* Author: Rob Miller and William Knottenbelt
   Program last changed: 30th September 2001    */

/* This program prints itself backwards. */

#include <iostream>
#include <fstream>
using namespace std;

const int MAXIMUM_FILE_LENGTH = 1000;
typedef char File_array[MAXIMUM_FILE_LENGTH];

int main()
{
	int count;
	char character;
	File_array file;
	ifstream in_stream;
	
	in_stream.open("6-1-2.cpp");
	in_stream.get(character);
	for (count = 0 ; ! in_stream.fail() && count < MAXIMUM_FILE_LENGTH ; count++) 
	{
		file[count] = character;
		in_stream.get(character);
	}
	in_stream.close();
	
	while (count > 0)
		cout << file[--count];
		
	return 0;
}
