Hi everyone
I did a counter to get the value from a simple number file, because I used the counter to
Code:
while ( counter <=10)
{
value=getline( filename, line);
sum+=value;
counter++;
}
now the problem if I had less than 10 lins in that file. it will give result of ( abnormal termination).
so, I changed it with
Code:
ifstream indata(filename)
while ( !filename.eof)
{
value=getline( filename, line);
sum+=value;
counter++;
}
but this gives me as well termination error with my orignal file with 10 lines and same error with a file of less than 10 line.
I know eof is not a good thing to terminate and exit the loop. but what else could I use.
so anyidea with example to fix similar error.
thank you all
all the result are wrong