Write a program that reads and prints a joke

Assignment Help C/C++ Programming
Reference no: EM131666017

Assignment

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

o void displayAllLines(ifstream &infile); //Display joke
o void displayLastLine(ifstream &infile); //Display punchline.

Attachment:- Joke-and-Punchline.rar

Reference no: EM131666017

Questions Cloud

Analyze the problem using path goal theory : Analyze the problem using Path Goal Theory. Use Path Goal Theory to propose a strategy for Mary.
What gases were present in the atmosphere : Early Earths environment-What was early earth like 4 billion years ago? and What color was the sky and the ocean - What was the heavy bombardment
Determine the ability level of the law enforcement agency : Determine the ability level of the law enforcement agency to effectively mitigate these types of crimes. Provide evidence to support your claim.
Define a lawsuit to reverse the agencys decision : The evidence presented to the agency was confusing and conflicting. You feel strongly that the company should not be penalized
Write a program that reads and prints a joke : Write a program that reads and prints a joke and its punch line from two different files. The first file contains a joke, but not its punch line.
What is ultimate concern and how does tillich describe god : What is an ultimate concern? What is the relationship between how a person lives her life and her ultimate concern? How does Tillich describe God?
Place to prevent discrimination : What are some interventions organizations can put in place to prevent discrimination?
Detailed map of most of the major leadership functions : The leadership action cycle provides a detailed map of most of the major leadership functions.
When is counsel effective : When Is Counsel Effective? The Supreme Court first tried to answer this question in the 1970 case of McMann v. Richardson.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd