I want to read a file (ie: C++ source code file or other) and count the characters that are used in pairs including ( ), [ ] and { }. The program must read all the lines of the file and count all occurrences of these characters. As its output, the program should summarize these counts and it
should provide suitable error messages in the event that the right and left members of the pairs are not balanced.
(Maybe even get the file specification for the target file from the command line.)I'm most interested in the number of lines in the file, the number of left and right parentheses, brackets, and curly braces. Error messages should be printed in the event of a mismatch.
I have had some success with this using other methods, but not writting the classes and using polymorphism. Can anyone help ?
should provide suitable error messages in the event that the right and left members of the pairs are not balanced.
(Maybe even get the file specification for the target file from the command line.)I'm most interested in the number of lines in the file, the number of left and right parentheses, brackets, and curly braces. Error messages should be printed in the event of a mismatch.
I have had some success with this using other methods, but not writting the classes and using polymorphism. Can anyone help ?