/*
The following program reads the name of an input file and then 
it counts the number of lines in the file.
 */
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main()
{
	ifstream inputFile;
	string inputFileName, line;
	int count = 0;
	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;
	}
	getline(inputFile,line);
	while (inputFile)
	{
		count++;
		getline(inputFile,line);
	}
	inputFile.close();
	cout << "The file has " << count << " lines."
		<< endl;
	return 0;
}
