Question: Chapter 13 - Programming Challenge #1, #2 File Previewer Write a program the asks the user for the name of a text file. The program

Chapter 13 - Programming Challenge #1, #2 File Previewer Write a program the asks the user for the name of a text file. The program should display the first 10 lines of the file on the screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been displayed. File Display Program Write a program the 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 10 lines of output at a time, and then pause. Each time the program pauses, it should wait for the sure to type a key before the next 10 lines are displayed. Additional Specifications Implement the solution in a class called assignment11_FileReader. (You will need to create a .h file and a .cpp file for the class) This class takes in the name of a text file via it's constructor It provides methods to read and display all the records in the file with line numbers. Here is the tester: #include iostream #include iomanip #include fstream #include string using namespace std; #include "Assignment11_FileReader.h" void display_file(string fname); int main() { display_file("assignment11_A.txt"); display_file("assignment11_B.txt"); return 0; } void display_file(string fname) { Assignment11_FileReader myfile(fname); cout << " " << fname << " : # of records in file = " << myfile.getNumRrecords() <<" "; myfile.displayFirst10records(); myfile.displayLast10records(); myfile.displayAllRecords(); }

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!