Question
C++ Program: count and print total Lines of Code LOC (ignore all comments in file) and Total LOC in contained in each function(s) (must print
C++ Program: count and print total Lines of Code "LOC" (ignore all comments in file) and Total LOC in contained in each function(s) (must print name of function and corresponding LOC in function). ORIGINAL REQUIREMENTS: Develop a software application that will do the following:
- Allow user to enter a file name, either by command line, prompt, or menu.
- Open specified file. If multiple files are specified or a directory is specified (not required, but a nice optional feature), the program operates on each file in sequence. For Each File: - Count the total number of Lines of Code, LOC, contained in the file.
- Report the name of the file.
- Report the total number of LOC contained in the file.
- Close the input file.
ADDITIONAL REQUIREMENTS:
Add the following functionality to a new function countFuncLOC();: Count the Function LOC:
- Count the number of LOC contained in each function in the file.
- For each function in the file:
- Report the name of the function.
- Report the number of LOC contained in the function.
The main program performs the following operations:
- Prompt the user for file name input.
- Open the file.
- Invoke the Function LOC counting function.
- Report of the File Name and file LOC count, each function name and the corresponding function LOC.
- Close the file BOTH the Function LOC and File LOC counting functionality shall be performed by a function called countFuncLOC. countFuncLOC receives a pointer to a valid open file and a pointer to a table for function data as passed parameters, and returns the integer number of LOC in the file. You must use the following countFuncLOC function definition: int countFuncLOC (ifstream &file, FUNCDATA *funcDataPtr); // C++ function prototype countFuncLOC may invoke the countLOC function if convenient. Otherwise, countFuncLOC will absorb the countLOC functionality. The Function LOC data shall be stored in a table defined in the main program and accessed by countFuncLOC() through a pointer to the table. All user input/output interaction functionality shall be performed by the main program; countFuncLOC shall have no direct user interface.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started