From 4d5c79512db1fd34e3295f088e951eda88a8257c Mon Sep 17 00:00:00 2001 From: anubis-x-ranger <44902527+anubis-x-ranger@users.noreply.github.com> Date: Tue, 22 Oct 2019 21:03:44 +0530 Subject: [PATCH] Stack file --- StackARR.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 StackARR.cpp diff --git a/StackARR.cpp b/StackARR.cpp new file mode 100644 index 0000000..374a265 --- /dev/null +++ b/StackARR.cpp @@ -0,0 +1,80 @@ +#include +#include +#include +class stack +{ + int stk[5]; + int top; + public: + stack() + { + top=-1; + } + void push(int x) + { + if(top > 4) + { + cout<<"Stack OverFlow."; + return; + } + stk[++top]=x; + cout <<"Inserted element is: " <=0;i--) + cout <>ch; + switch(ch) + { + case 1: cout <<"\nEnter the element to be added: "<>ch; + st.push(ch); + break; + case 2: st.pop(); + break; + case 3: st.topp(); + break; + case 4: st.display(); + break; + case 5: exit(0); + } + } + getch(); +}