Implementation:
#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
stack<int> st;
int choice, item;
while (1)
{
cout<<"\n---------------------"<<endl;
cout<<"Stack Implementation in Stl"<<endl;
cout<<"\n---------------------"<<endl;
cout<<"[Link] Element into the Stack"<<endl;
cout<<"[Link] Element from the Stack"<<endl;
cout<<"[Link] of the Stack"<<endl;
cout<<"[Link] Element of the Stack"<<endl;
cout<<"[Link]"<<endl;
cout<<"Enter your Choice: ";
cin>>choice;
switch(choice)
{
case 1:
cout<<"Enter value to be inserted: ";
cin>>item;
[Link](item);
break;
case 2:
item = [Link]();
[Link]();
cout<<"Element "<<item<<" Deleted"<<endl;
break;
case 3:
cout<<"Size of the Stack: ";
cout<<[Link]()<<endl;
break;
case 4:
cout<<"Top Element of the Stack: ";
cout<<[Link]()<<endl;
break;
case 5:
exit(1);
break;
default:
cout<<"Wrong Choice"<<endl;
}
}
return 0;
}