-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathStack
More file actions
40 lines (31 loc) · 735 Bytes
/
Stack
File metadata and controls
40 lines (31 loc) · 735 Bytes
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
/* *********************************************************
* KNOWLEDGE CENTER
* st::stack
* Detailed Video Explanation: https://youtu.be/WK97Pj0wa7A
********************************************************** */
#include <iostream>
#include <stack>
using namespace std;
int main(){
stack<int> S;
for(int i = 0; i < 5; ++i)
S.push(i);
cout << "Size = " << S.size() << endl;
cout << "Top = " << S.top() << endl;
S.pop();
S.pop();
cout << "Size = " << S.size() << endl;
cout << "Top = " << S.top() << endl;
if(S.empty())
cout << "Stack is empty\n";
else
cout << "Not Empty\n";
return 0;
}
/*
size()
=
top()
empty()
push(), pop()
*/