liststack.h

来自「该压缩文件夹内有诸多常用算法和数据结构的c++模板编程实现」· C头文件 代码 · 共 41 行

H
41
字号
#ifndef LISTSTACK_H
#define LISTSTACK_H
#include "ListStack.h"
template<class T>
class ListStack
{
protected:
	LinkedList<T> list;
public:
	bool isEmpty()
	{
		if (list.size()==0)
		{
			return true;
		}
		return false;
	}
	T topEl()
	{
		return list.get(list.size()-1);
	}
	T pop()
	{
		T el=list.get(list.size()-1);
		list.remove(list.size()-1);
		return el;
	}
	void push(T el)
	{
		list.add(el);
	}
	int size()
	{
		return list.size();
	}
	void clear()
	{
		list.clear();
	}
};
#endif

⌨️ 快捷键说明

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