题目链接:https://leetcode.cn/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/
题解思路: 按照下面的函数设计实现一下就OK,很简单,不写了

代码:
class CQueue {
stack<int> stack_in,stack_out;//定义栈
public:
CQueue() {
}
void appendTail(int value) {
stack_in.push(value); //入栈
}
int deleteHead() {
if(!stack_out.empty()){
int res=stack_out.top();//出栈
stack_out.pop();
return res;
}else{
while(!stack_in.empty()){
stack_out.push(stack_in.top());
stack_in.pop();
}
if(!stack_out.empty()){
int res=stack_out.top();
stack_out.pop();
return res;
}else{
return -1;
}
}
}
};
/**
* Your CQueue object will be instantiated and called as such:
* CQueue* obj = new CQueue();
* obj->appendTail(value);
* int param_2 = obj->deleteHead();
*/