MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/stl/Stack & Operations.cpp:5–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5int main()
6{
7 stack<int>s;
8 //add elements
9 s.push(4);
10 s.push(5);
11 s.push(6);
12 s.push(7);
13
14 //remove elements from last
15 s.pop();
16
17 //display the top most elements
18 cout<<s.top()<<endl;
19
20 //display the size of the stack
21 cout<<s.size()<<endl;
22
23 //checking if stack is empty or not
24 if (s.empty())
25 {
26 cout<<"Yes Empty"<<endl;
27 }
28 else
29 {
30 cout<<"No Not Empty"<<endl;
31 }
32
33 return 0;
34}

Callers

nothing calls this directly

Calls 4

topMethod · 0.80
pushMethod · 0.45
popMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected