SMALL

 

class Stack
{
private:
	int *stack;
	int top;
	int capacity;
public:
	Stack(int Capacity = 1000);
	int IsEmpty()const;
	int &Top()const;
	void Push(const int &item);
	void Pop();
};
Stack::Stack(int stackCapacity) : capacity(stackCapacity)
{
	stack = new Int[capacity];
	top = -1;
}
int Stack::IsEmpty() const
{
	if (top == -1) return 1;
	else return 0;
}
int & Stack::Top() const
{
	return stack[top];
}
void Stack::Push(const int & item)
{
	stack[++top] = x;
}
void Stack::Pop()
{
	top--;
}
LIST

'전공 > 알고리즘' 카테고리의 다른 글

C/C++ 하노이탑  (0) 2021.06.05

+ Recent posts