I'm trying to write a c++ program to implement queue in ubuntu os using codelite IDE, I still didn't complete the program but I am getting an error when I checked if the code I wrote was correct or not
error: missing template arguments before ‘ob’
error: expected ‘;’ before ‘ob’
#include<iostream>
#include<math.h>
#include<stdlib.h>
#define size 10
usingnamespace std;
template<class t>
class que{
public:
int count;
t q[size];
que(){
char c,o;
cout<<"Queue is created\n(you can choose other options after creating the queue)\nDo you want to enter any elements?[y/n] :";
cin>>c;
if(c=='y'||'Y'){
t x;
do{
cout<<"Enter the element :";
cin>>x;
q[count]=x;
count++;
cout<<"Do you want to continue?[y/n] :";
cin>>o;
}while(o=='y'||'Y');
}
}
int length();
t get(int);
int search(t);
void enter(t);
void leave();
void show();
};
template<class t>int que<t>::length(){
return count;
}
template<class t>t que<t>::get(int i){
return q[i];
}
template<class t>void que<t>::enter(t a){
q[count]=a;
}
template<class t>void que<t>::leave(){
for(int i=0;i<count-1;i++)
q[i]=q[i+1];
count--;
}
template<class t>void que<t>::show(){
for(int i=0;i<count;i++)
cout<<q[i]<<endl;
}
template<class t>int que<t>::search(t z){
int n=0,p[10],r;
for(int i=0;i<count;i++){
if(q[i]=z){
p[n]=i;
n++;
}
}
r=n;
for(int i=0;i<n;i++)
r=r+p[i]*pow(10,i+1);
return r;
}
main(){
que ob;
int m;
cout<<"1.Size of queue\n2.Display the queue\n3.To enter an element\n4.Remove an element\n5.To get an element of queue\n6.To search for an element in queue\n7.Exit"<<endl;
cout<<"Choose an option :";
switch(m){
default: cout<<"There is no option "<<m<<"."<<endl;
case 1:break;
case 2:break;
case 3:break;
case 4:break;
case 5:break;
case 6:break;
case 7:exit(0);
}
}