push pop code in c 2b 2b

Solutions on MaxInterview for push pop code in c 2b 2b by the best coders in the world

showing results for - "push pop code in c 2b 2b"
Daren
17 Sep 2017
1#include<iostream>
2using namespace std;
3#define Max 100
4class stack{
5	public:
6		int top;
7		int size;
8		int *s;
9		int stack[Max];
10		
11		void push()
12		{
13			int value;
14			if(top==size-1)
15			{
16				cout<<"overflow";
17			}
18			else
19			{
20				cout<<"Enter value to push \n";
21				cin>>value;
22				top++;
23				stack[top]=value;
24			}
25		}
26		int pop()
27		{
28			if(top==-1)
29			{
30				cout<<"Underflow";
31			}
32			else
33			{
34				cout<<"Deleted value is \n"<<stack[top];
35				top--;
36			}
37		}
38		void display()
39		{
40			int i;
41			for(i=top;i>=0;i--)
42			{
43				cout<<stack[i]<<endl;
44			}
45		}
46};
47int main()
48{
49	stack st;
50	cout<<"Enter the size of the stack";
51	cin>>st.size;
52	st.s=new int[st.size];
53	st.top=-1;
54	int ch;
55	while(st.size!=0)
56	{	
57	cout<<endl<<"    #####       STACK MENU     #####     "<<endl;
58	cout<<"1. PUSH OPERATION \n2. POP OPERATION \n3. DISPLAY \n4.Exit \n";
59	cin>>ch;
60	switch(ch)
61	{
62		case 1: 
63		    st.push();
64		    break;
65		case 2:
66			st.pop();
67			break;
68		case 3:
69			st.display();
70			break;
71		case 4:
72			exit(0);
73			
74		default:cout<<"\n Choose correct option";
75	}
76}
77return 0;
78}
queries leading to this page
function for inserting and deleting into a stack c 2b 2binput in stack c 2b 2b formake stack c 2b 2bstack implementation cppstack using an array c 2b 2bpredefined stack push method for char in c 2b 2bc push syntaxstack pushpush and pop value in array c 2b 2bpush stackpush pop code in c 2b 2bstack push stlchar stack push display in c 2b 2bstack push cppstack push 2c pop program in c 2b 2bstack pop function gfgcode of push and pop function in c 2b 2bpushing one stack value to other stack in c 2b 2b elen element by elementprogram to take input and push it to stackc 2b 2b stack pop implementationstack by array in c 2b 2bpush and pop in stack in c 2b 2bpop in stack in c 2b 2bwhen writing a programming language in c 2b 2b how do you implement stackcreate string stack and insert element and display it in c 2b 2bstack pop in cppwrite to perform push pop operation in stack c 2b 2bcpp stack codestack using array in c 2b 2b using structimplementing stak using array in cppstack push c 2b 2bstack using array in c 2b 2bpush and pop subprogram in c 2b 2bc 2b 2b stack push and popc 2b 2b push pophow to create a stack in c 2b 2bc 2b 2b push and popimplementation of stack using array in c 2b 2b programsarray push and pop front of stackpush in c 2b 2bpush and poppop an item from the stack code c 2b 2bcode to pop in c 2b 2bc 2b 2b program to implement stack using arrayprogram to push and pop elements in stackstack implementation in cpppop and push in stack in c 2b 2bstack implementation in c 2b 2bcpp push and pop operationisarray push and pop in c 2b 2bwhich stl class is best for push and poparray based stack c 2b 2bpop a particulr element from stack in c 2b 2bstack using array in cppc 2b 2b stack array based implementationpush operation in stack in c 2b 2b programstack push pop c 2b 2bhow to create a stack c 2b 2bstack implementation using array c 2b 2bstack using arrays in c 2b 2bstack implementation in c 2b 2b using arrayc 2b 2b pop and pushpop in array c 2b 2bwap in c 2b 2b to implement all the operations 28push 2c pop and display 29 of stack using object creation the program should be menu driven i e user has the choice which operation they want to execute push pop c 2b 2bhow to push element in stackstack inserthow many elements stack can add in cppstack cpp implementationtaking input in a stackpop and push in stack in c 2b 2b using classcode of push and pop function without stack in c 2b 2bc 2b 2b program to implement stack using arraysstack pushpush and pop function in stack in c 2b 2bstack c 2b 2b implementationc 2b 2b push 2c pop 26 display two different stack elementsimplementation of stack push and pop operations in c 2b 2bpush and pop c 2b 2bc 2b 2b stack implementationwrite a program to implement stack using array and perform push and pop operations in c 2b 2bhow to make a stack in c 2b 2binsert in stack c 2b 2bstack inputpop implementation c 2b 2bpush and pop in cpppush elements in stack c 2b 2bstack implementation using cpppop in stack c 2b 2bstacks with arrays in c 2b 2bpop stack stlpush and pop application c 2b 2bhow to write pop function inside class stck c 2b 2bcreate a stack in c 2b 2b and push itemshow to out put a stack c 2b 2bhow to pop elements of stack in c 2b 2bwhat is push and pop in wappop in stack in cpphow to make stack of an array in c 2b 2bpush stack c 2b 2bhow to create stack in c 2b 2bpush in stack c 2b 2bpush c 2b 2bc 2b 2b basic stack implementationpop in stlstack using array c 2b 2bstack program in c 2b 2bprogram for implementing stack using array in cppstack push c 2b 2bstack implementation using array in cpppush pop c 2b 5didentify this c statement 2c to push e in to stack 3bpush in stack in c 2b 2bwrite a program to implement stack using array implement stack in c 2b 2bstack push in c 2b 2bc 2b 2b push and pop application stacks gfg stl popcreate stack c 2b 2bcpp stack implementationadd element to stack c 2b 2bhow to push onto the stack in c 2b 2binsert three parameters in pop function stackstack implementation using array in c 2b 2bc 2b 2b pop codestack push pop program in c 2b 2bstack with arrays in c 2b 2bpush function in stack cppimplement stack using array c 2b 2bimplement array to stack in c 2b 2bstack data structure implementation type c 2b 2bhow many elements an i add in stack cppstack using procedure c 2b 2bfull stack using array code c 2b 2bpop in stack stldoes stack push 28stack pop 28 29 29 work 3fimplement stack using array in cppstack usno c 2b 2bstack implemenmtation in c 2b 2bstack pushingimplementation of stack using array in data structurehow to push data in stackdeclare array of characters in c 2b 2b and push pop in stackpop array c 2b 2bpop in stack c 2b 2b stlstack using procedurec 2b 2bpush pop code in c 2b 2b