#include <iostream>
#include <conio.h>
using namespace std;
struct DOUB_LIST
{
DOUB_LIST *pre;
int dota;
DOUB_LIST *next;
};
class MY_DOUB_LIST
{
public:
MY_DOUB_LIST();//初始化链表
~MY_DOUB_LIST();//删除全部链表
bool set_doub_list_link(int);//创建一个节点,成功则返回true
bool delet_doub_list_link(int);//删除一个节点,成功则返回true
bool inser_doub_list_link(int,struct DOUB_LIST *);//插入一个节点到指定位子,成功则返回true
bool inser_doub_list_link(int,int);//插入一个节点到指定值域的地方,成功则返回true
bool show_doub_list();//遍历并输出节点上的值,若链表为空返回flase
// bool sort_up();//以num从小到大排序,若链表为空返回FLASE
// bool sort_down();//以num重大到小排序;若链表为空返回FLASE
struct DOUB_LIST *searc_p_l(int);//查找一个节点,该节点值域为num,返回该节点指针
struct DOUB_LIST *get_p_now();//获得当前节点
private:
struct DOUB_LIST *p_head;//永远指向头节点。
struct DOUB_LIST *p_now;//指向当前节点。
};
用类写了一个双向链表。我想的是将结构体放入类中,这样封装性会不会强点?求指教啊><!
还有我发现周围的同学怎么都不用c++的高级特性呢!