Question: IN C++. Im using XCODE you can try it with any file instead of weblog.txt. For this project, download the text file weblog.txt Note: To
IN C++.
Im using XCODE
you can try it with any file instead of weblog.txt.
For this project, download the text file weblog.txt
Note: To download this file, right click on the link and select SAVE AS
For this project, you can use each line of the web log file as one string. Remember, each line of the file represents one page request.
Requirements:
Create a class that includes the following functions to work with the weblog.cpp file (you must use these prototypes exactly):
void openWebLog(); //a function to open the weblog.txt file.
int size(); //a function to return the total number of lines in the weblog. Your main function should then display the return value.
void lineNum( int index); //a function to display a line from the file when a line number is provided. Your main function should send over an index number in the parentheses when it calls this function.
Hint: These functions need to share the file, so you will need to hold it in the private section of the class. There are a few different approaches that you might consider (optional):
Create a main function in a separate .cpp file that creates an object of your class and calls each of the functions. Remember to #include your header file!
Important Note: All functions must be in your class and all functionality must be in the functions of the class. The only code in your main function should be the code that creates an object of your class and calls its functions. No other code should in the main function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
