ما الخطأ بهذا الكود
#include <iostream>
#include <conio.h>
using namespace std;
const int max=50;
void push();
void pop();
void display();
int top=-1,item,stack[max];
int main()
{int x;
do{
cout<<"enter 1 to push"<<"\n";
cout<<"enter 2 to pop"<<"\n";
cout<<"enter 3 to display "<<"\n";
cout<<"enter 4 to exit"<<"\n";
cin>>x;
switch(x){
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
default:
cout<<"invalid"<<"\n";}
}
while(x!=4);
getch();
}
void push(){
if(top==max-1)
cout<<"stack is full"<<"\n";
else {cout<<"enter item"<<"\n";
top++;
stack[top]=item;
cout<<"item inserted"<<"\n";}
}
void pop( ){
if(top==-1)
cout<<"stack is empty"<<"\n";
else{
stack[top]=item;
top--;
cout<<"item deleted"<<"\n";
}
}
void display(){
int i;
if(top==-1)
cout<<"stack empty"<<"\n";
else{
for(i=top;i>=0;i--)
cout<<stack<<"\n";
}
}
