File Display Program. Write a program that asks the user for the name of a file. The program should display the content 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 the 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.
Punch Line. Write a program that reads and prints a joke and its punch line from two different files (please keep it clean). The first file contains a joke, but not its punch line. The second file has the punch line as its last line, preceded by “garbage text” (does not matter what it is). NOTE: the last sentence (punch line) will have a newline character before it. The program is to search for the start of the last sentence; it should NOT move backward from the file a fixed number of characters. It should work for any punch line file. The main function of your program should open the two files and then call two functions, passing each one the file it needs. The first function should read and display each line in the file it is passed (the joke file). The second function should display only the last line of the file it is passed (the punch line file). IT should find this line by seeking to the end of the file and then
backing up to the beginning of the last line. Data to test your program can be found in the joke.txt and punchline.text files provided at the textbook web site.
Program must have the following functions
- void displayAllLines(ifstream &infile); //Display joke
- void displayLastLine(ifstream &infile); //Display punchline