-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.h
66 lines (65 loc) · 2.39 KB
/
interface.h
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
#pragma once
void interface() {
PriorityQueue<int> queue;
while (true) {
std::cout << "Priority Queue (int)\n"
"1. Push\n"
"2. Use default queue:\n"
"Priority 1: 5, 4, 3\n"
"Priority 2: 1, 2, 3\n"
"Priority 3: 3, 3, 3\n"
"3. Pop\n"
"4. Pop Everything\n"
"5. Map(decrement)\n"
"6. Reduce(multiply all elements)\n"
"7. Concat with mapped queue\n"
"8. Where(Only elements > 2)\n"
"9. Run tests\n"
"10. Exit\n"
"Enter: ";
int answer;
cin >> answer;
switch (answer) {
case 1:
cout << "Enter number: ";
int num;
cin >> num;
int priority;
cout << "Enter priority: ";
cin >> priority;
queue.Push(num, priority);
break;
case 2:
queue = InitializeQueue();
break;
case 3:
cout << queue.Pop();
break;
case 4:
cout << queue;
break;
case 5:
queue.Map(decrement);
break;
case 6:
cout << queue.Reduce(multiply_items, 1);;
break;
case 7:
{
PriorityQueue<int> queue2 = queue;
queue2.Map(decrement);
queue.Concat(queue2);
}
break;
case 8:
queue.Where(more_then_two);
break;
case 9:
TestAll();
break;
default:
exit(0);
}
cout << endl;
}
}