Just count the lines as they are being read
std::string line;
int counter = 0;
while ( getline(myfile, line) )
{
++counter;
cout << left << setw(4) << counter << line << "\n";
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Great news :) Now you can go on to more advanced problems.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343