Check out example codes for "c++ insertion in astack". It will help you in understanding the concepts better.

Code Example 1

stack<int> a;
a.push(5);
a.push(6);
//.....

Learn ReactJs, React Native from akashmittal.com