for example, there are 100 lines from the file, and I only want to show 20 lines and ask the user to press enter and then another 20 line display and so on to the end of the file.
here is my code
int main()
{
ifstream infile;
string filename;
string line;
int lineCount = 0;
cout << "Enter file name: \n";
cin >> filename;
system("cls");
infile.open(filename);
if (!infile)
{
cout << "\nErrors\nNo file exist.\n";
exit(1);
}
else
{
while (infile.good())
{
lineCount++;
getline(infile, line);
cout << lineCount << ":\t" << line << endl;
}
}
return 0;
}