/*
The following program reads the name of an input file and then 
it copies the contents of the file exactly as they look like in 
the file to another file whose name is entered by the user, but it 
inserts a number at the beginning of each line.
 */
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main()
{
	ifstream inputFile;
	ofstream outputFile;
	int count = 0;
	string inputFileName, outputFileName, line;
	cout << "Enter the name of the input file: ";
	cin >> inputFileName;
	inputFile.open(inputFileName.c_str());
	if (!inputFile)
	{
		cout << "Can't open the file." << endl;
		return 1;
	}
	cout << "Enter the name of the output file: ";
	cin >> outputFileName;
	outputFile.open(outputFileName.c_str());
	getline(inputFile,line);
	while (inputFile)
	{
		count++;
		outputFile << "(" << count << ") " << line << endl;
		getline(inputFile,line);
	}
	inputFile.close();
	outputFile.close();
	return 0;
}
