03 2019 档案

摘要:总结:析构器在析构时,若未定义str2的临时指针变量,str2会析构错误;不要改变指针位置,使用下标进行比较 阅读全文
posted @ 2019-03-25 19:43 学之初 阅读(441) 评论(0) 推荐(0)
摘要:#include #include #define MAXSIZE 5 using namespace std; typedef struct { char *elem; //储存空间基地址 int length; //当前长度 }SqList; //初始化顺序表 int InitList(SqList *L) { L->elem=new char[MAXSIZE];... 阅读全文
posted @ 2019-03-21 13:14 学之初 阅读(377) 评论(0) 推荐(0)
摘要:#if 1 #include #include using namespace std; class List { public: //默认构造函数集合大小为6个元素 List(); //构造函数重载,可接受参数,改变集合大小 List(int size); //析构函数释放str, ~List() { delete []str; } //打印数据 voi... 阅读全文
posted @ 2019-03-20 13:20 学之初 阅读(1217) 评论(0) 推荐(0)
摘要:#if 1 #include #include #include using namespace std; struct Node { int data; Node *next; }; //初始化 Node *init() { Node *head=new Node; head->next=NULL; return head; } //头插法创建节点 void insetLis... 阅读全文
posted @ 2019-03-17 11:44 学之初 阅读(387) 评论(0) 推荐(0)
摘要:#if 1 #include #include #include using namespace std; struct Node { int data; Node *next; }; //初始化 Node *init() { Node *head=new Node; head->next=NULL; return head; } //头插法创建节点 void insetLis... 阅读全文
posted @ 2019-03-16 11:15 学之初 阅读(1023) 评论(0) 推荐(0)
摘要:#if 1 #include #include #include using namespace std; struct Node { int data; Node *next; }; //初始化 Node *init() { Node *head=new Node; head->next=NULL; return head; } //头插法创建节点 void insetLis... 阅读全文
posted @ 2019-03-15 13:42 学之初 阅读(1927) 评论(0) 推荐(0)
摘要:总结:链表的遍历注意不要随意改变头指针的位置,进行合并时需要声明三个结构体指针用于进行合并,注意某一链表结束时需要进行链接,再释放生成的链表. 阅读全文
posted @ 2019-03-14 14:58 学之初 阅读(3160) 评论(0) 推荐(0)
摘要:#if 1 #include #include #include #include #include using namespace std; //类 class List { public: //构造器初始化,生成头节点 List() { head = new Node; head->next=NULL; } //成员函数 void createLis... 阅读全文
posted @ 2019-03-09 15:08 学之初 阅读(4038) 评论(0) 推荐(1)