C++ Program for implementing stack operations with templates

Templates:
Templates are pre-defined codes which can be used when and where needed. Templates enhance reusability and reduces the coding time.

C++ Program for implementing stack operations with the help of template methods:

#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
template<class Type>
class StackOperation  
{
Type x[10];
int t,s;
public:
StackOperation()
{
t=-1;
cout<<"Enter size of the Stack : ";
cin>>s;
}
void pushopr(Type element)
{
if(t<s-1)
x[++t]=element;
else
cout<<"stack overflows. Cannot perform push operation \n \t "<<element<<endl;
}
void popopr()                         
{
if(t<0)
cout<<" stack is underflowing or empty\t\n";
else
cout<<"\nThe Popped element is : "<<x[t--];
}
void stack_opr();
};
template<class Type>
void StackOperation<Type> :: stack_opr()
{
int option=1,j;                        
Type element;
while(option>0 && option<3)
{
cout<<"\n1.PUSH 2.POP Press a Key for Exit \n \t Option: ";  
cin>>option;
switch(option)
{
case 1 : //Push operation
cout<<"Enter the element to push into the stack : ";
cin>>element;
pushopr(element);
cout<<"\t\n The content of the stack are:";
for(j=0;j<=t;j++)
cout<<x[j]<<"\n";
break;
case 2 : //pop operation
popopr();
cout<<"The content of stack are:\n\t";
for(j=0;j<=t;j++)
cout<<x[j]<<"\n\t";
break;
}
}
}
 main()
{ s=x, t=top, n=s

clrscr();
cout<<"Operations of Stack with Template functions\n";
cout<<"\nINTEGER\n";   StackOperation<int> stack1;
cout<<"\nFLOATING POINT\t\n";  StackOperation<float> stack2;
int c;
while(1)
{
cout<<"\n\tSTACK OPERATIONS \n";
cout<<"1.INT EGER STACK \t 2.FLOATING POINT STACK\t \n Press any Key for Exit\n Option : ";
cin>>c;
switch(c)
{
case 1 : //perform integer stack operation
stack1.stack_opr();  
break;
case 2 : //floating point stack operation
stack2.stack_opr();
 break;
default : cout<<”\n You have entered a wrong choice”;
}
}
}