-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack_class.cpp
37 lines (32 loc) · 1.16 KB
/
stack_class.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
#include "stack_class.h"
int main()
{
my_stack stack;
int choice;
cout << "Init main" << endl;
//stack.init(); //Started using constructure
do {
cout << "1: For Insert data\n2: For delete data\n:0: For exit" << endl;
cin >> choice;
switch (choice) {
case 1: int data;
cout << "Insert value" << endl;
cin >> data;
if (!(stack.is_full())) {
stack.push(data);
} else {
cout << "stack is full. Please do pop" << endl;
}
break;
case 2: if (!(stack.is_empty())) {
cout << "data ====>" << stack.pop() << endl;
} else {
cout << "stack is empty. Please do push" << endl;
}
break;
case 0: //stack.exit();
break;
}
} while (choice);
return 0;
}