Question: Write a program that asks the user for the name of a file . The program should display the contents of the file on the

Write a program that asks the user for the name of a file.

The program should display the contents of the file on the screen.

If the file's contents won't fit on a single screen, the program should display 24 lines of output at a time, and then pause.

Each time the program pauses it should wait for the user to strike a key before the next 24 lines are displayed.

--------------------------------------------------------------------------------------------------

//There have so many errors, please change whatever you want to be correct answer -thank you so much for helping!

//.Display Program

#include #include

#include

using namespace std;

int main (int argc, char *argv[]) { ifstream in_stream;

//open the file in_stream.open("Display_Input.txt");

string data;

//count the no of lines read and printed int count=0;

//loop till end of the file while(!in_stream.eof()) { //read the file data count++; getline(in_stream,data);

//if no of lines printed are less than 10 then print if(count <=24){ cout< } else{ cout << "Press ENTER to continue to print the next records from file " << endl; int ch = cin.get(); while (ch != ' ') { ch = cin.get(); } //reset the count count=0; cout< }

} //close the stream in_stream.close();

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!