Improving Algorithm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Counter Number Of Lines Already Existing In The File
	do
	{
		file >> num;		//Get ID
		if(!file)
			break;
		counter++;

		//Get Next Line
		do
		{
			c = (char)file.get();
		}while(file.good() && c != '\n');
	}while(file.good());


Every line shall begin with an ID(long);
The Algorithm shall count the number of lines existing...

How would You do this?...
If you don't care about the contents, it's much simpler. Just use getline to read an entire line in a loop while (file), and count the lines.
ahhh... why didnt i think about that T_T...

thank you:)...
Topic archived. No new replies allowed.