Node.h:
#ifndef NODE_H
#define NODE_H
template <class T>
class Node
{
public:
Node<T> *next;
Node<T> *prev;
T data;
};
#endif //TEST1_NODE_H
List.h:
#ifndef LINK_H
#define LINK_H
#include "Node.h"
#include <iostream>
template <class T>
class List
{
public:
List();//默认构造函数
List(const List& ln);//拷贝构造函数
~List();//析构函数
void add(T e);//向链表添加数据
void ascSort();//升序排序
void remove(T index);//移除某个结点
T find(int index);//查找结点
bool isEmpty();//判断是否为空
int size();//链表长度
void show();//显示链表
void resShow();//链表反向显示
void removeAll();//删除全部结点
private:
Node<T> *head;
Node<T> *tail;
int length;
};
//
//默认构造函数
template <typename T>
List<T>::List()
{
head = new Node<T>;
tail = new Node<T>;
head->next = tail;
h