-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
78 lines (60 loc) · 1.94 KB
/
main.cpp
File metadata and controls
78 lines (60 loc) · 1.94 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
#include <iostream>
#include "SearchServer.h"
#include "ConverterJSON.h"
int main() {
using namespace std;
try
{
using namespace search_server;
SearchServer::getInstance();
string command;
while(true)
{
cout << "---Search Engine is started!---" << endl;
cout << "----Search Engine work now!----" << endl;
cout << "------------- Menu ------------" << endl;
cout << "'1' for enter the request;" << endl;
cout << "'2' for show server info;" << endl;
cout << "'3' for exit." << endl;
cout << "-------------------------------" << endl;
cout << "Enter the command:";
cin >> command;
cin.clear();
system("cls");
if(command == "1")
{
string request;
cin.ignore();
std::cout << "Enter request:";
std::getline(std::cin, request);
list<pair<string, float>> results = SearchServer::getInstance().getAnswer(request);
std::cout << "--- Result: " << results.size() << " ---" << endl;
for(const auto& result: results)
std::cout << result.first << " \trelativeIndex:" << result.second << endl;
std::cout << "---End---" << endl;
}
else if(command == "2")
SearchServer::getInstance().showSettings();
else if(command == "3")
break;
else
cout << "Unknown command" << endl;
system("pause");
system("cls");
}
}
catch(ConverterJSON::myExp& e)
{
e.show();
system("pause");
}
catch(search_server::SearchServer::myExp& e)
{
e.show();
system("pause");
}
system("cls");
std::cout << "---Bye, bye!---" << endl;
system("pause");
return 0;
}