///////////////////// // // This program analyses the frequency at which a particular // website was visited given the url and the name of an index.dat // file. #include #include #include #include using namespace std; int main(){ //////////////////// // Declare variables // Stuff for input string index_file_name; // file name to be opened ifstream index_file; // the stream for the index file string target_url; // URL we are interested in // Stuff for the computing int total_number_of_days = 0; int total_number_of_hits = 0; int days_with_hits = 0; bool hit_today = 0; string current_day = ""; string type, time, date, domain, file, cache; float percentage; // Say what the program does cout << "This program computes how often a particular URL is visited" << endl; cout << "on a daily basis. The inputs are the index.dat file to be" << endl; cout << "tested and the URL of interest. The output is the total" << endl; cout << "number of days covered in the file, the number of visits " << endl; cout << "to the specified URL, and the percentage of days the" << endl; cout << "specified URL was visited." << endl << endl; // Input the file name to open cout << "Please enter the filename to be investigated: "; cin >> index_file_name; cout << endl; // Open the file or die if it fails index_file.open (index_file_name.c_str()); if (!index_file) { cerr << "The file named: " << index_file_name << " was not found." << endl; exit(1); } // Input the url to be found cout << "Please enter the URL to be searched for: "; cin >> target_url; cout << endl; // start reading through the index file while (index_file >> type >> time >> date >> domain >> file >> cache){ // This was the line I put in to make sure that it was reading correctly // cerr << type << " " <