#include<fstream>
#include<iostream>
#include<string>
usingnamespace std;
int main()
{
ifstream inFile; //Declares a file stream object
string fileName;
string word;
int size=0;
int count = 0;
char a;
int lines=1;
cout << "Please enter the file name ";
getline(cin,fileName);
inFile.open(fileName.c_str());
while(!inFile.eof())
{
inFile >> word;
size+=word.length();
count++;
}
inFile.seekg (0);
while (inFile.good ())
{
a=inFile.get ();
if (a=='\n')
{
lines++;
}
}
cout << "Number of words in file is " << count ;
cout << "\n";
cout << "The total number of characters entered is: " << size ;
cout << "\n";
cout << "In file is "<< lines<<" lines";
inFile.close();
cin.get();
return 0;
}