Question: Write a C++ program for the simple counting tool that reads lines from a file until the end of file. The program should prompt

Write a C++ program for the simple counting tool that reads lines 

Write a C++ program for the simple counting tool that reads 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. The program should consider the first word following the '%' character of a command line as a command name. If no word is found, or a word is not recognized as one of the three commands, an error message should be printed out followed by the line number. See the example below for the format of the error message.

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 Programming Questions!