代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航


You should be comfortable with the content in the modules up to and including the module "Input Output" for this project.


You must follow the style guide for all projects.


Download the text file weblog.txt 

Note: To download this file, right click on the link and select SAVE AS or SAVE TARGET AS or similar option


This file is an Apache web log taken from the web server for St. Mary's University. When a visitor goes to their web site, the visitor's browser makes a request to the web server to view a web page, which is a file residing on the server. Each time a page is requested by a browser, the web server records information about that request. This weblog.txt holds the details of some of those requests. See below for a list of fields with an example:


Web Log Example


This file does not include all possible information that could be collected by a web server. The full description of the apache log file format can be found here: http://httpd.apache.org/docs/2.2/logs.html


For this project, you can use each line of the web log file as one string using the string class' getline function.  The module tutorial "Input Output With Files" demonstrates this. Additionally the module lab "Input Output" gives you some practice.


Minimum Requirements:


All functions must be non-member functions (not part of any class) (4 points).

Create a non-member function to read each line of the web log file. Each line should then be stored in a vector such that the first element of the vector is the first line of the web log file. Because each element will hold an entire line from the file, the vector should be declared as a vector of strings.  (4 points)

You must declare the vector in a function (4 points).

Create one more non-member function to write the first 50 elements of the vector to a file. Because this is a non-member function, you will need to pass the vector by reference to this function, so it should accept a vector of strings in its parameter list.  Each element of the vector should be on its own line in the new file. The contents of the new file should look like the original input file once your program completes, but only the first 50 lines of that file (4 points).  

Create a main function that calls all of your non-member functions (4 points).

http://www.santarosa.edu/~lmeade/style.html

http://www.santarosa.edu/~lmeade/weblog.txt

http://www.santarosa.edu/~lmeade/weblog.html


相关推荐