i am trying to print 10 lines from a text file, and print another 10 based on user input or stop. My code print 10 lines but the first line is blank each time.
cin>>input;
ifstream file("midterm.txt");
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;