/*
* ä½¿ç¨æ£åé¾è¡¨
* åååé¾è¡¨å卿æ°ç»æ¥å®ç°ä¸ä¸ªæ
* @author : light
* E-mail: [email protected]
*
* */
#include
using namespace std;
struct node
{
int data;
node *next;
}
class Stack
{
public:
Stack();
bool pop();
int top() const;
bool push(const int data);
int size() const;
~Stack();
private:
node *p_top;
node *p_bottom;
node *cur;
int size;
}
Stack::Stack()
{
p_top = p_bottom = NULL;
size = 0;
}
int Stack::push(const int data)
{
node *temp;
if (size == 0)
{
temp = new node;
temp->data = data;
p_bottom = temp;
p_top = temp;
cur = temp;
cur->next = NULL;
++size;
}
else
{
temp = new node;
node->data = data;
p_top = temp;
cur->next = temp;
cur = cur->next;
cur->next = NULL;
}
}
int Stack::top() const
{
return p_top->data;
}
int Stack::size() const
{
return size;
}
Stack::~Stack()
{
while ()
}
bool Stack::pop()
{
}