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

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

/* This program copies itself to "Copy_of_5" and to the screen. */ 

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

int main()
{
	char character;
	ifstream in_stream;
	ofstream out_stream;

	in_stream.open("5-5-1.cpp");
	out_stream.open("Copy_of_5");
	
	in_stream.get(character);
	while (!in_stream.eof()) 
	{
		cout << character;
		out_stream.put(character);
		in_stream.get(character);
	}
	
	out_stream.close();
	in_stream.close();

	return 0;
}
