通讯录链表实现之C++
生活随笔
收集整理的這篇文章主要介紹了
通讯录链表实现之C++
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
在mooc上學習了鏈表中的順序表和單鏈表,并使用單鏈表數據結構跟著老師完成通訊錄創建。通過這次鏈表練習使用,做一些總結。
自頂向下設計探索。
功能需求
在功能實現上,通訊錄主要包括,創建聯系人,刪除聯系人,顯示聯系人,退出通訊錄。
通訊錄
?
軟件設計
?
?
附錄:
鏈表頭文件相關聲明定義
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
節點頭文件相關聲明定義
Node.h
#ifndef NODE_H #define NODE_H#include "Person.h" class Node { public:Person date;Node *next;void printNode(); };#endif
數據域相關聲明定義
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
?
轉載于:https://www.cnblogs.com/stonebloom-yu/p/6585694.html
總結
以上是生活随笔為你收集整理的通讯录链表实现之C++的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第三章 最小化SpringXml 配置
- 下一篇: s3c2440移植MQTT