-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch_engine_main.cpp
More file actions
161 lines (142 loc) · 4.7 KB
/
Copy pathsearch_engine_main.cpp
File metadata and controls
161 lines (142 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include "search_engine_header.h"
#include<iostream>
#include<iomanip>
#include<time.h>
#include<unistd.h>
#include<string.h>
using namespace std;
int main()
{
search_engine A;
int opt;
string val="";
string key="";
char c;
//system("clear");
//cout.width(115);
cout<<"** SEARCH ENGINE HISTORY **"<<endl;
cout<<"\n\t A Search Engine is a software system that is designed to carry out web searches,\n\t which means to search the World Wide Web in a systematic way for particular information \n\t specified in a textual web search query.";
cout<<"\n\n\nTHE FOLLOWING SITE HAS ALL SEARCHES MADE TODAY. \nTIME OF SEARCH ALONG WITH THE DATA CAN BE ACCESSED! \n";
cout<<"\nCONTINUE: Y/N : " ;
cin>>c;
if(c=='Y')
{
//system("clear");
do
{
//system("clear");
cout<<"\n\n\t\tOPERATIONS OFFERED BY SEARCH HISTORY:";
cout<<"\n\t\t-------------------------------------\n";
cout<<"\n\t1.Make a search \n\t2.Remove your search from history \n\t3.Access your search history \n\t4.Most frequently browsed.\n\t5.Most recently browsed \n\t6.To give suggestions. \n\t7.Display search history \n\t8.Empty the browser history \n\t9.Clear browser history and Exit \n\t10.Exit \n";
cout<<"\nEnter your option: ";
cin>>opt;
switch (opt)
{
case 1:
//system("clear");
cout<<"\nSearch or type a URL: ";
cin.ignore();
getline(cin,val);
key=create_key();
A.insert(key,val);
A.display();
sleep(4);
break;
case 2:
//system("clear");
A.display();
cout<<"\nEnter keyword or the entire URL: ";
cin.ignore();
getline(cin,val);
A.find_key(val);
if(flag==1)
{
cout<<"\nSearch not found";
}
else
{
cout<<"\n\nAfter deletion :\n"<<endl;
A.display();
}
flag=1;
sleep(4);
break;
case 3:
//system("clear");
cout<<"\n\tAccess searches: ";
cout<<endl;
A.display();
cout<<"\n\nEnter keyword: ";
cin.ignore();
getline(cin,val);
A.search_(val);
if(flag_s==1)
{
cout<<"\nSearch not found";
}
flag_s=1;
sleep(4);
break;
case 4:
//system("clear");
cout<<"\nTo check frequencies of searches made: \n"<<endl;
A.freq();
A.print_max_min();
sleep(4);
break;
case 5:
//system("clear");
cout<<"\n\n\t Most recently accessed node: ";
A.most_recently_searched();
sleep(4);
break;
case 6:
//system("clear");
cout<<"\n\tSUGGESTIONS: ";
cout<<"\n\nEnter keyword (length 3) :";
cin.ignore();
getline(cin,val);
A.partialchecking(val);
if(flag_p==1)
{
cout<<"\nSearch not found";
}
flag_p=1;
sleep(4);
break;
case 7:
//system("clear");
A.display();
sleep(4);
break;
case 8:
//system("clear");
A.clear();
cout<<"\n\n History is cleared!!!\n";
A.display();
sleep(4);
break;
case 9:
//system("clear");
A.make_empty();
cout<<"\nBrowser History cleared! "<<endl;
cout<<"\nTHANK YOU! VISIT LATER TO CHECK THE SEARCH HISTORY! :)\n";
sleep(4);
exit(0);
break;
case 10:
cout<<"\nTHANK YOU! VISIT LATER TO CHECK THE SEARCH HISTORY! :)\n";
exit(0);
break;
default:
cout<<"\nEnter appropriate option!!";
break;
}
} while (opt!=10);
}
else
{
cout<<"\nTHANK YOU! VISIT LATER TO CHECK THE SEARCH HISTORY! :)";
}
return 0;
}