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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started