list.h
来自「大学期间写的一个简单的词法分析器,通过输入符合自定义语法规则的程序,得到分析的二」· C头文件 代码 · 共 42 行
H
42 行
#include "iostream.h"
template<class type> class listnode
{
public:
type data;
listnode<type> *link;
listnode();
};
template<class type> listnode<type>::listnode()
{
link=NULL;
}
template<class type> class list
{
public:
list();
void insert(type value);
listnode<type> *first,*last;
};
template<class type> list<type>::list()
{
first=last=NULL;
}
template<class type> void list<type>::insert(type value)
{
if(first==NULL)
{
first=new listnode<type>;
first->data=value;
last=first;
last->link=NULL;
}
else
{
listnode<type> *newnode=new listnode<type>;
newnode->data=value;
last->link=newnode;
last=last->link;
last->link=NULL;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?