В вашем коде вы должны добавить ios::ate
, чтобы линии работали, и вы также должны показать, какой тип используются переменными. Попробуйте это:
string input;
string sentinel = "#";
string output;
cin>>input;
ifstream file("midterm.txt",ios::ate);
while(input != sentinel && file >> output ) {
for(int i = 0; i < 10; i++) {
getline(file, output);
cout<<output<<endl;
}
cout<<"\nEnter any key to continue reading, enter # to stop"<<endl;
cin>>input;
}
file.close();
cout<<"File End";
return 0;