STARTING OUT WITH C++ MPL
STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
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
class BinaryImage:       def __init__(self):           pass             def compute_histogram(self, image):           """Computes the histogram of the input image           takes as input:           image: a grey scale image           returns a histogram as a list"""                 hist = [0]*256                 return hist             def find_otsu_threshold(self, hist):           """analyses a histogram it to find the otsu's threshold assuming that the input hstogram is bimodal histogram           takes as input           hist: a bimodal histogram           returns: an optimal threshold value (otsu's threshold)"""                 threshold = 0                 return threshold             def binarize(self, image):           """Comptues the binary image of the the input image based on histogram analysis and thresholding           take as input           image: an grey scale image           returns: a binary image"""                 bin_img = image.copy()                 return…
List collection views of a map interface
data structures in java

Chapter 15 Solutions

STARTING OUT WITH C++ MPL

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
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT