i have implemented queue using two stacks but my code is not working
#include <bits/stdc++.h>
using namespace std;
class Queue{
stack s1;
stack s2;
public:
void push(int element){
s1.push(element);
}
void pop() {
if(s1.empty()){
return;
}
while(s1.size()>1) {
int ele = s1.top();
s1.pop();
s2.push(ele);
}
s1.pop();
swap(s1,s2);
}
int front1() {
if(s1.empty()){
return 0;
}
while(s1.size()>1) {
s2.push(s1.top());
s1.pop();
}
int element = s1.top();
s1.pop();
s2.push(element);
swap(s1,s2);
return element;
}
};
int main() {
Queue q;
//q.push(1);
q.push(2);
q.push(3);
cout<<q.front1();
q.pop();
cout<<q.front1();
return 0;
}