通讯录链表实现之C++
生活随笔
收集整理的這篇文章主要介紹了
通讯录链表实现之C++
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前言
在mooc上學(xué)習(xí)了鏈表中的順序表和單鏈表,并使用單鏈表數(shù)據(jù)結(jié)構(gòu)跟著老師完成通訊錄創(chuàng)建。通過(guò)這次鏈表練習(xí)使用,做一些總結(jié)。
自頂向下設(shè)計(jì)探索。
功能需求
在功能實(shí)現(xiàn)上,通訊錄主要包括,創(chuàng)建聯(lián)系人,刪除聯(lián)系人,顯示聯(lián)系人,退出通訊錄。
通訊錄
?
軟件設(shè)計(jì)
?
?
附錄:
鏈表頭文件相關(guān)聲明定義
List.h
#ifndef LIST_H #define LIST_H#include "Node.h"class List { public:List();~List();void ClearList();bool ListEmpty();int ListLength();bool GetElem(int i, Node *pNode);int LocateElem(Node *pNode);bool PriorElem(Node *pCurrentNode, Node *pPreNode);bool NextElem(Node *pCurrentNode, Node *pNextNode);bool ListInsert(int i, Node *pNode);bool ListDelete(int i, Node *pNode);bool ListInsertHead(Node *pNode);bool ListInsertTail(Node *pNode);void ListTraverse();private:Node *m_pList;int m_iLength; };#endif
節(jié)點(diǎn)頭文件相關(guān)聲明定義
Node.h
#ifndef NODE_H #define NODE_H#include "Person.h" class Node { public:Person date;Node *next;void printNode(); };#endif
數(shù)據(jù)域相關(guān)聲明定義
Person.h
#ifndef PERSON_H #define PERSON_H#include <string> #include <ostream>using namespace std;class Person {friend ostream &operator<<(ostream &out, Person &person); //Global Function public:string name;string phone;Person &operator=(Person &person);bool operator==(Person &person); };#endif
?
轉(zhuǎn)載于:https://www.cnblogs.com/stonebloom-yu/p/6585694.html
總結(jié)
以上是生活随笔為你收集整理的通讯录链表实现之C++的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 第三章 最小化SpringXml 配置
- 下一篇: JS 键盘监听事件 enter 13