Question: Help needed with C++ code i will up vote! only done in C++ Write a C++ program that acts like a simple counting tool for

Help needed with C++ code i will up vote! only done in C++
Help needed with C++ code i will up vote! only done in
C++ Write a C++ program that acts like a simple counting tool
for collecting information from textual files of documents prepared for a simple
scripting language 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 " A" or "
" at the beginning of the line, which would be skipped by

Write a C++ program that acts like a simple counting tool for collecting information from textual files of documents prepared for a simple scripting language 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 " A" or " " at the beginning of the line, which would be skipped by the scripting interpreter. All other noncommented 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 the 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 of commented lines, the maximum length of non-commented lines, the commented line of maximum length delifnited by double quotes, and the noncommented line of maximum length delimited by double quotes. See the examples in the presentation shides for the expected output format. \begin{tabular}{l|l} Line number & File contents \\ \hline 1 & run prog1 \\ 2 & /l \\ 3 & delete \\ 4 & \#\# execute next command \\ 5 & delete myfile \\ 6 & \\ 7 & \\ 8 & copy filel file2 \\ 9 & // welcome to cs 280 \\ 10 \\ 11 \\ 12 & print myfile \\ 13 \\ End of File marker & // terminate script \end{tabular} Hinclude iostream \#include iomanip> using namespace std; int main() \{ ifstream inclientFiley string filename; I/ if a filename is provided, open file cout "Enter the name of a file to read from: " endl; cin filenamej inclientFile. open (filename. cstr()); if ( linclientFile) \{ cerr \& endl; cerr "File cannot be opened" exit (1); \} cout left setw (18) "Account" set(13) "Name" "Balance" endl fixed showpoint int account; char name[ 30 ]. double balances II display each record in file while (inclientfile account name balance) f. cout left setw (10) account setw(13) name setw(8) setprecision (2) right balance end 13 J I/ end while return e3 If ifstream destructor closes file 3I end main using namespace std; j int main() int character; // II prompt user to enter line of text cout "Before input, cin.eof() is "ks cin.eof() endl \& "Enter a sentence followed by end-of-file:"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!