Made changes to stack program using array implementation

This commit is contained in:
Shivam Singhal 2017-05-17 00:31:19 +05:30
parent 1dd1312085
commit fce50afe2a

View File

@ -36,6 +36,10 @@ void show()
}
}
void topmost()
{
cout << "\nTopmost element: "<<stack[top-1];
}
int main()
{
int ch, x;
@ -44,7 +48,8 @@ int main()
cout<<"\n1. Push";
cout<<"\n2. Pop";
cout<<"\n3. Print";
cout<<"\nEnter Your Choice : ";
cout<<"\n4. Print topmost element:";
cout<<"\nEnter Your Choice : ";
cin>>ch;
if (ch==1)
{
@ -60,6 +65,10 @@ int main()
{
show();
}
else if(ch==4)
{
topmost();
}
}
while(ch!=0);