diff --git a/Data Structures/Stack and Queue /stackarray.cpp b/Data Structures/Stack and Queue /stackarray.cpp new file mode 100644 index 0000000..374a265 --- /dev/null +++ b/Data Structures/Stack and Queue /stackarray.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(); +}