-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
57 lines (42 loc) · 874 Bytes
/
main.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "list.h"
#include "queue.h"
#include "stack.h"
#include <iostream>
void print(LinkedList &list) { list.print(); }
void testQueue() {
Queue queue;
for (int i = 0; i < 10; i++)
queue.push(i);
for (int i = 100; i > 90; i--)
queue += i;
std::cout << queue.peek() << std::endl;
print(queue);
for (int i = 0; i < 5; i++) {
std::cout << queue.pop() << std::endl;
}
print(queue);
}
void testStack() {
Stack stack;
for (int i = 0; i < 10; i++)
stack.push(i);
for (int i = 100; i > 90; i--)
stack += i;
std::cout << stack.peek() << std::endl;
print(stack);
for (int i = 0; i < 5; i++) {
std::cout << stack.pop() << std::endl;
}
print(stack);
}
void testList() {
List list;
for (int i = 0; i < 10; i++)
list.insert(i, i);
print(list);
}
int main() {
testQueue();
testStack();
testList();
}