Hey I'm having troubles with my while loop, Im sure it somethings simple, but basically, it loops one time too many for example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int main()
{
ifstream file;
int line1, line2, line3;
file.open("TriangleLines.txt");
while(file){
GetNum(file,line1, line2, line3);
cout<<line1<<" "<<line2<<" "<<line3;// this line gets outputed twice no matter where i place it.
cout<<endl;
file.close();
}
return 0;
}
so my problem is that line 10 gets outputed twice even where is only one line of data, or even if there are more then 2 lines, but it always reads the first line just fine.