Merge pull request #16 from shivhek25/master

Data structure updation
This commit is contained in:
Anup Kumar Panwar 2017-05-17 08:51:40 +05:30 committed by GitHub
commit 191db0d365

View File

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