#include <iostream>
#include <stack>
using namespace std;
int GetSackBotton(stack<int>& stk)//递归,抽出栈低元素
{
int n = stk.top();
stk.pop();
if (stk.size() == 0)
return n;
int result= GetSackBotton(stk);
stk.push(n);
return result;
}
void ReverseStack(stack<int>& stk)
{
int n = GetSackBotton(stk);
if (stk.empty())
{
stk.push(n);
return;
}
ReverseStack(stk);
stk.push(n);
}
int main()
{
stack<int> stk;
for (int i = 1; i < 6; i++)
stk.push(i);
ReverseStack(stk);
return 0;
}