-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyStackClassArrTest.cpp
More file actions
71 lines (51 loc) · 1.42 KB
/
Copy pathMyStackClassArrTest.cpp
File metadata and controls
71 lines (51 loc) · 1.42 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
#include "clsMyStackArr.h"
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
clsMyStackArr <int> MyStack;
MyStack.push(10);
MyStack.push(20);
MyStack.push(30);
MyStack.push(40);
MyStack.push(50);
cout << "\nStack: \n";
MyStack.Print();
cout << "\nStack Size: " << MyStack.Size();
cout << "\nStack Top: " << MyStack.Top();
cout << "\nStack Bottom: " << MyStack.Bottom();
MyStack.pop();
cout << "\n\nStack after pop() : \n";
MyStack.Print();
//Extension #1
cout << "\n\n Item(2) : " << MyStack.GetItem(2);
//Extension #2
MyStack.Reverse();
cout << "\n\nStack after reverse() : \n";
MyStack.Print();
//Extension #3
MyStack.UpdateItem(2, 600);
cout << "\n\nStack after updating Item(2) to 600 : \n";
MyStack.Print();
//Extension #4
MyStack.InsertAfter(2, 800);
cout << "\n\nStack after Inserting 800 after Item(2) : \n";
MyStack.Print();
//Extension #5
MyStack.InsertAtFront(1000);
cout << "\n\nStack after Inserting 1000 at top: \n";
MyStack.Print();
//Extension #6
MyStack.InsertAtBack(2000);
cout << "\n\nStack after Inserting 2000 at bottom: \n";
MyStack.Print();
//Extension #7
MyStack.Clear();
cout << "\n\nStack after Clear(): \n";
MyStack.Print();
cout << "\n==================================================\n";
cout << " ALL TESTS COMPLETED SUCCESSFULLY \n";
cout << "==================================================\n";
system("pause>0");
}