Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- stack<int>st;
- st.push(5); //5
- st.push(1); //1,5
- st.push(3); //3,1,5
- cout<<"Top element right now : "<<st.top()<<endl; //3
- int a = st.top();
- st.pop();
- cout<<"We have just poped : "<<a<<endl;
- cout<<"Top element right now : "<<st.top()<<endl; //1
- //To see all the elements of stack
- while(st.size()!=0){
- cout<<st.top()<<" ";
- st.pop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement