CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* There are some mistakes in this program if someone find that mistake please let me know*/
#include <iostream>
#include <stdlib.h>
#include <conio.h>
using namespace std;
int stack[10], size=5, top=-1,value,i;
void push();
void pop();
void display();
void push()
{
if(top>=-1)
cout<<"stack is overflowed";
else
{
cin>>value;
top++;
stack[top]=value;
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run