Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 15, Problem 6PC
Program Plan Intro

Removal of Line Breaks

Program Plan:

  • Include the required header files to the program.
  • Definition for filter class.
    • In public, declare the function for “do_Filter()”.
    • In protected, declare the function for “transform(char ch)”.
  • Include the required function prototypes.
  • Function definition of the function “do_Filter()”.
    • Declare the variable "letter" to get the character stored in the file.
    • Loop to check the end of file.
    • Output the characters to the file.
    • Get the character from the input file.
  • Derived class “Line_Break”.
    • In protected, define the “transform ()” function.
      • Inside the function return the value to the function.
    • In public, declare the “do_Filter ()” function.
  • Definition of “do_Filter ()” function.
    • Check the input file contains the line breaks.
      • If so, removal the line breaks and adds a space between the each word.
      • Otherwise, call the “transform ()” function.
    • Declare the “File_print()” function.
  • Define the main() function.
    • Declare the require variable to hold the input and output file.
    • Get the file name from the user.
    • Create an object for the input file.
    • Check the file open condition using “while” loop.
      • Exit the program for invalid filename.
    • Call the function “File_print()”.
    • Get the output file name from the user.
    • Create an object for the output file.
    • Check the file open condition using “while” loop.
      • Exit the program for invalid filename.
    • Creating an object for “Line_Break ()”.
    • Close output file.
    • Re open the file to print the content.
    • Close all files.
  • Function definition for the function “File_print()”.
    • Clear the content of the file.
    • Seek arbitrary position in the file.
    • Loop to check the end of file.
      • Print the character.
    • Clear the content of the file.
    • Seek arbitrary position in the file

Blurred answer
Students have asked these similar questions
Please original work What topic would be related to architectures or infrastructures. How you would implement your chosen topic in a data warehouse project. Please cite in text references and add weblinks
What is cloud computing and why do we use it? Give one of your friends with your answer.
What are triggers and how do you invoke them on demand? Give one reference with your answer.

Chapter 15 Solutions

Starting Out with C++: Early Objects (9th Edition)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education