Coding Homework C++ Classes, Read, Constructer Etc

Posted Under: Coding

Ask A Question
Viewed 18
Call: CPPGrep search string file1 [file2 ....] CPPGrep searches the specified files line by line for the search string and returns those lines in which the search string occurs, including their line number standard output on. The number of hits within the file must also be output after each file. It should also be possible to save the results in a file. Use an abstract class named AbstractFileCommand containing the following abstract methods contains: • Constructor that receives an array of filenames and the search string. • read(): Reads in all files, processes them and saves the results. • write(string filename): Saves the results to a file. • print(): Returns the results either as a string or as an object of another class output back to the caller The CPPGrep class, which appropriately implements the methods for the grep command, inherits from this purely abstract class The dialog is pretty simple: the user invokes the program through a terminal command as described above. The file names are passed as command line parameters. To processing, the results are output to the screen and the user is asked whether he would also like to save the results in a file. If so, he gives one filename. The class CPPCount should also inherit from the abstract class AbstractFileCommand and with the following functionality: Just like CPPGrep, when invoked as Command line parameters several files can be given. Then the characters and counted the lines in the files. The output takes place again on the screen using the print() method and optionally to a file. Call CPPCount file1 [file2 ....]

This order does not have tags, yet.


No uploads for this question

Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.


NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: Coding Homework C++ Classes, Read, Constructer Etc or similar questions only at Tutlance.

Related Questions