📄 list.h
字号:
// list.h: interface for the list class.
//
//////////////////////////////////////////////////////////////////////
#ifndef HEADFILE_LIST
#define HEADFILE_LIST
class list // 线性表类
{
private:
list(const list&){};
void operator = (const list&){};
protected:
struct Node{ // 定义结点结构
int value;
Node* next;
};
Node *head; // 线性表头
Node *tail; // 线性表尾
public:
list();
virtual ~list();
bool empty(); // 判断线性表是否为空
void clear(); // 清空线性表
void print(); // 打印线性表
};
class stack: public list
{
private:
stack(const stack&){};
void operator = (const stack&){};
public:
stack(){};
int pop(); // 弹出栈顶元素
void push(int value); // 压栈
};
class queue: public list
{
private:
queue(const queue&){};
void operator = (const stack&){};
public:
queue(){};
int outqueue(); // 取出队头元素
void inqueue(int value);// 加入新元素到队尾
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -