#include<bits/stdc++.h>
using namespace std;
class Queue{
int cs;
listqu;
//contructor
public:
Queue(int ds=4){
cs=0;
}
bool isEmpty(){
return cs==0;
}
void enqueue(int data){
qu.push_back(data);
cs++;
}
void dequeue(){
if(!isEmpty()){
qu.pop_front();
cs–;
}
}
int getfront(){
return qu.front();
}
};
int main(){
Queue q(10);
for(int i=1;i<4;i++)
q.enqueue(i);
}
Please explain error in this code
Hello @Detoxo_16,
The way you have shared your code has introduced many syntax errors to it.
So, always share your code using Online Coding Blocks IDE.
STEPS:
- Paste your code at https://ide.codingblocks.com
- Save it there.
- Share the URL generated.
Now, taking about your code:
As, it had few syntax errors, so I don’t know what was the actual error in your code.
But, you can compare your original code with the one i have corrected:
Hope, this would help.
Give a like if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.