Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
STL Stack, C ++
//STL STACK PUSHER // ____ _ __ ____ ____ // | _ \ | |/ / |___ \ | _ \ // | |_) | | ' / __) | | | | | // | _ < | . \ / __/ | |_| | // |_| \_\ |_|\_\ |_____| |____/ // //By <Same Noobs> #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
Range List for C++
isnan_constexpr
12/2
AnnotateAttr templated test
11/29
DESim Example Starter Code
Uno v2
range based for loop temporary object lifetime issue example
List comprehension in C++ using functional patterns
Wrapper to pass shared_ptr to &, const &, *, const * through std::bind.