i have to write some code that reads from a file until it reaches the end. it looks kind of like this:
Code:
ifstream input;
input.open(inputfile);
while(!input.eof())
{
input >> string;
cout << string << endl;
}
the file that it's reading from looks like this:
but for some reason, the above while loop will print out:
Code:
aaa
bbb
ccc
ddd
ddd
i can't figure out what's making it loop the extra time.