Tuesday, August 18, 2009

c++: stack and queue and array-list=> stack

const int size = 1024;

class stack {
private:
int top;
int item[size];
public:
stack() {top = -1;}
~stack();
void push(int x) { item[++top] = x}
int pop () { return item[top--];}

int empty(int top);
};

No comments:

Post a Comment