Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
STL stack
//Title of this code //clang 3.6.0 #include <iostream> #include <stack> using namespace std; int main(void) { stack <int> st1,st2; int j; cout<<"Pushing data into stack..."<<endl; st1.push(21); j=st1.top(); cout<<j; st1.push(9); j=st1.top(); cout<<j; st1.push(12); j=st1.top(); cout<<j; st1.push(31); j=st1.top(); cout<<j<<endl; stack<int>::size_type i; i=st1.size(); cout<<"The stacklength is"<<i<<endl; i=st1.top(); cout<<"The element at the top of the stack is"<<i<<endl; st1.pop(); i=st1.size(); cout<<"After a pop,the stack length is"<<i<<endl; i=st1.top(); cout<<"After a pop,the element at the top of the stack is"<<i<<endl; return 0; }
run
|
edit
|
history
|
help
0
hw1 Os
pointer to pointer
Composite pattern
applidiumResto_NicolasCarre
Linear search
DESim Example with Hash Table
marquee text in C++
Erase a std::unordered_map::local_iterator by key
Throttle Example in C++
10 naturalnumbers