⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seqstack.h

📁 上传几个数据结构源代码
💻 H
字号:
#include"Stack.h"
template<class T>
class SeqStack:public Stack<T>
{
	private:
		T *m_pData;
		int m_nLenth;
		int m_top;
    bool    Create(int max)
	{
		m_pData=new T[max];
		return true;
	}
	public:
	SeqStack(int max=20)
	{
		Create(max);
		m_nLenth=max;
		m_top=-1;
	}

	~SeqStack()
	{
		if(m_pData)
			delete m_pData;
	}
	bool IsFull()const
	{
		return m_top>=m_nLenth-1;
	}
	bool IsEmpty()const
	{
		return m_top<=-1;
	}
	void Pop()
	{
	    	m_top--;
	}
	void Push(T & x)
	{
		m_pData[++m_top]=x;
	}
    T Top()const
	{
		return m_pData[m_top];
	}



};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -