Free Sample

Write C++

Write C++.  DUE BY 10/1/17 @ 8:00 PM
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

Write C++

Calculate the Price

Approximately 250 words

Total price (USD) $: 10.99