-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
executable file
·104 lines (88 loc) · 2.26 KB
/
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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "LinkedList.h"
#include "Stack.h"
int main() {
Stack stack; // start out with empty stack
// invoke the default DVC of Stack
// which will invoke the DVC of LinkedList
// okay to push and pop chars with our stack
// each node in the linked list stores an int
// A is ASCII value 65
string toReverse = "Stack ADTS are awesome!!";
int asciiValue = -1;
for (char c : toReverse) {
stack.push(c);
}
cout << stack.size() << endl;
cout << "Output: ";
while (!stack.isEmpty()) {
asciiValue = stack.pop();
cout << static_cast<char>(asciiValue);
}
cout << endl;
/*cout << "Pushing" << endl;
stack.push(5);
stack.push(3);
cout << stack.peek() << endl;
cout << stack.isEmpty() << endl;
cout << stack.size() << endl;
int value = -1;
cout << "Popping" << endl;
value = stack.pop();
cout << value << endl;
cout << stack.peek() << endl;
cout << stack.isEmpty() << endl;
cout << stack.size() << endl;
cout << "Popping" << endl;
value = stack.pop();
cout << value << endl;
cout << stack.peek() << endl;
cout << stack.isEmpty() << endl;
cout << stack.size() << endl;
*/
cout << "Pushing and clearing" << endl;
stack.push(5);
stack.push(3);
stack.clear();
cout << stack.peek() << endl;
cout << stack.isEmpty() << endl;
cout << stack.size() << endl;
/*LinkedList list; // start out empty list
list.insertAtFront(12);
list.insertAtFront(5);
list.insertAtFront(3);
list.displayList();*/
/*list.deleteNode(3); // delete first node
list.displayList();
list.deleteNode(5);
list.displayList();
list.deleteNode(12);
list.displayList();
list.deleteNode(4);
list.displayList();*/
/*list.deleteAtEnd();
list.displayList();
list.deleteAtEnd();
list.displayList();
list.deleteAtEnd();
list.displayList();
list.deleteAtEnd();
list.displayList();*/
/*list.deleteAtFront();
list.displayList();
list.deleteAtFront();
list.displayList();
list.deleteAtFront();
list.displayList();
list.deleteAtFront();
list.displayList();
*/
//list.appendNode(15);
/*list.displayList();
list.insertInOrder(7);
list.displayList();
list.insertInOrder(2);
list.displayList();
list.insertInOrder(15);
list.displayList();*/
return 0;
}