-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
85 lines (80 loc) · 2.34 KB
/
Main.cpp
File metadata and controls
85 lines (80 loc) · 2.34 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
#include <iostream>
#include "datatype.hpp"
#include "AVL_Tree.cpp"
#include "trie.cpp"
#include "functions.cpp"
#include <chrono>
#include "tempFile.cpp"
using namespace std;
int main()
{
searchEngine obj;
obj.readData();
char dec, c;
int count, type;
string str;
cout << "Welcome to Courses search Engine. \nYou can browse Udemy and Coursera courses.\n"
<< endl;
cout << "Press any key to continue. . .\n";
cin >> dec;
do
{
cin.sync();
cout << "1. Press 1 or T to search via keywords." << endl;
cout << "2. Press 2 or S to search category-wise." << endl;
cout << "3. Press 3 or F to browse free courses." << endl;
cout << "4. Press 4 or E to search exact course names." << endl;
cout << "5. Press 5 or A to use autocomplete." << endl;
cout << "6. Press q to Quit." << endl;
c = getchar();
switch (toupper(c))
{
case 'T':
case '1':
cin.sync();
cout << "Please enter a keyword that you wish to search" << endl;
obj.browseCourses();
break;
case 'S':
case '2':
cin.sync();
cout << "Please enter a Category that you wish to search" << endl;
obj.searchCategoryWise();
break;
case 'F':
case '3':
cout << "Enter the number of courses to be returned: ";
cin >> count;
cin.sync();
cout << "Press any key to continue . . .\n";
cout << "Press 1 for just course names: ";
cin >> type;
cout << endl;
if (type == 1)
obj.searchFreeCourses(count, 1);
else
obj.searchFreeCourses(count, 0);
break;
case 'E':
case '4':
cin.sync();
obj.searchExactCourse();
break;
case 'Q':
dec = 'Q';
break;
case 'A':
case '5':
cin.sync();
obj.autoComplete();
break;
default:
cout << "Invalid input" << endl;
}
cin.sync();
cout << "Press any key to continue. . .\n";
cout << "At any moment Press Q to quit: ";
cin >> dec;
system("cls");
} while (toupper(dec) != 'Q');
}