-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSource.cpp
40 lines (38 loc) · 965 Bytes
/
Source.cpp
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
#include <iostream>
#include "RBpriority_stack.h"
#include "stack.h"
int main()
{
PriorityStack<int> pS;
pS.Push(12, 12);
pS.Push(4, 4);
pS.Push(17, 17);
pS.Push(3, 3);
pS.Push(7, 7);
pS.Push(5, 5);
pS.Push(9, 9);
pS.Push(10, 10);
pS.Push(12, 12);
std::cout << pS.IsEmpty() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n';
std::cout << pS.Pop() << '\n'; //will throw an exception as an attempt to pop from an empty buffer has been registered
pS.Clear();
std::cout << pS.IsEmpty() << '\n';
pS.Push(12, 12);
pS.Push(4, 4);
pS.Push(17, 17);
pS.Push(3, 3);
pS.Push(7, 7);
pS.Push(5, 5);
pS.Push(9, 9);
pS.Push(10, 10);
std::cout << pS.Pop() << '\n';
}