Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that acts like a simple counting tool for collecting information from textual files of documents prepared for a simple scripting

  

Write a C++ program that acts like a simple counting tool for collecting information from textual files of documents prepared for a simple scripting langu interpreter. An input file for the simple scripting interpreter includes two types of data, commented lines and scripting code lines. A commented line is recognized by either the two characters "##" or "//" at the beginning of the line, which would be skipped by the scripting interpreter. All other non- commented lines are considered as part of the scripting code, including any blank lines with whitespace. The program for the simple counting tool should read lines from a file until the end of file. The program should prompt the user for the file name to read from. The program should open the file for reading, and if the file cannot be opened, it should print the message "File cannot be opened", followed by th filename, and exit. After reading the contents of the input file, the program should print out the total number of lines, the number of commented lines, the maximum length commented lines, the maximum length of non-commented lines, the commented line of maximum length delimited by double quotes, and the non- commented line of maximum length delimited by double quotes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions

Question

2 Does the new structure support Payment Operations objectives?

Answered: 1 week ago

Question

Is the level of visibility appropriate?

Answered: 1 week ago