{"id":372,"date":"2011-11-02T14:55:00","date_gmt":"2011-11-02T06:55:00","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=372"},"modified":"2020-06-06T14:57:35","modified_gmt":"2020-06-06T06:57:35","slug":"%e7%ae%80%e6%98%93%e9%80%9a%e8%ae%af%e5%bd%95%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=372","title":{"rendered":"\u7b80\u6613\u901a\u8baf\u5f55\u4ee3\u7801"},"content":{"rendered":"\n<p>\u6700\u8fd1\u95f2\u6765\u65e0\u4e8b\uff0c\u505a\u4e2a\u901a\u8baf\u5f55\uff0c\u6700\u57fa\u7840\u7684\u90a3\u79cd\uff0c\u79bb\u5b9e\u7528\u5dee\u5f97\u8fdc\u4e86\uff0c\u7eaf\u7cb9\u5f53\u7ec3\u624b\u4e86\uff0c\u6240\u4ee5\u4e0d\u8981\u62b1\u6709\u4ec0\u4e48\u5e7b\u60f3\uff0c\u563f\u563f\u2026<\/p>\n\n\n\n<p><br>\u4e3b\u8981\u662f\u6709\u70b9\u5fd8\u8bb0C++\u7684\u8fd0\u7b97\u7b26\u91cd\u8f7d\u4e86\uff0c\u53e6\u5916\u7531\u4e8e\u5f53\u65f6\u5b66C++\u65f6\u76f4\u63a5\u628a\u6587\u4ef6\u90a3\u4e00\u7ae0\u8df3\u4e86\u8fc7\u53bb\uff0c\u4e5f\u60f3\u501f\u6b64\u673a\u4f1a\u7ec3\u4e60\u4e00\u4e0b\uff0c\u8fd8\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u539f\u56e0\u5c31\u662f\u624b\u673a\u8981\u5237\u673a\uff0c\u867d\u7136\u7f51\u4e0a\u4e0d\u5c11\u5907\u4efd\u7a0b\u5e8f\uff0c\u8fd8\u662f\u60f3\u8d81\u673a\u5199\u4e2a\u81ea\u5df1\u7528\uff0c\u563f\u563f\u2026<\/p>\n\n\n\n<p><br>\u6536\u83b7\u6709\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n\n\n\n<p><br>1.\u4f7f\u7528\u6587\u4ef6\u91c7\u7528\u7a0b\u5e8f\u5f00\u59cb\u65f6\u5168\u90e8\u8bfb\u5165\uff0c\u7ed3\u675f\u540e\u5168\u90e8\u8f93\u51fa\u7684\u65b9\u5f0f\uff0c\u6574\u4e2a\u7a0b\u5e8f\u8fd0\u884c\u65f6\u53ea\u8fdb\u884c\u4e24\u6b21\u6587\u4ef6\u7684\u8bfb\u5199\uff08\u8fd9\u4e2a\u662f\u5b66\u957f\u4ecb\u7ecd\u7684\u65b9\u6cd5\uff09\uff0c\u7531\u4e8e\u6570\u636e\u4e0d\u7b97\u5e9e\u5927\uff0c\u91c7\u7528\u8fd9\u79cd\u65b9\u6cd5\u7a7a\u95f4\u6548\u7387\u8fd8\u53ef\u4ee5\uff1b<\/p>\n\n\n\n<p><br>2.\u628a\u6240\u6709\u64cd\u4f5c\u653e\u5728\u7c7b\u7684\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u8fd9\u6837\u53ef\u4ee5\u9020\u6210\u81ea\u52a8\u8c03\u7528\u7684\u6548\u679c\uff08\u867d\u7136\u4e0d\u77e5\u9053\u8fd9\u6837\u505a\u6709\u6728\u6709\u4ec0\u4e48\u6f5c\u5728\u5371\u5bb3\uff09\uff1b<\/p>\n\n\n\n<p><br>3.\u53d1\u73b0\u539f\u6765\u7c7b\u578b\u7684\u58f0\u660e\u53ef\u4ee5\u653e\u5728\u7c7b\u4e2d\uff0c\u800c\u4e14typedef\u5305\u542b\u7684struct\u58f0\u660e\u4e2d\u53ef\u4ee5\u6709\u7c7b\u4f3c\u6784\u9020\u51fd\u6570\u7684\u6210\u5458\u51fd\u6570\u51fa\u73b0\uff0c\u53ef\u4ee5\u81ea\u52a8\u5b8c\u6210\u521d\u59cb\u5316\u64cd\u4f5c\uff0c\u975e\u5e38\u65b9\u4fbf\uff0c\uff08\u4ee5\u524d\u4e00\u76f4\u7528\u7c7b\u6765\u7740\uff0c\u770b\u8d77\u6765\u6709\u70b9\u6740\u9e21\u7528\u725b\u5200\u7684\u611f\u89c9\uff09\uff1b<\/p>\n\n\n\n<p><br>\u7f3a\u70b9\u662f\uff1a<\/p>\n\n\n\n<p><br>1.\u4e0d\u80fd\u6309\u59d3\u6c0f\u6392\u5217\u8bb0\u5f55\uff1b<br>2.\u6ca1\u6709\u68c0\u67e5\u53f7\u7801\u4f4d\u6570\u4ee5\u5224\u65ad\u8f93\u5165\u662f\u5426\u5408\u6cd5\u7684\u529f\u80fd\uff1b<br>3.\u4ee3\u7801\u4e0d\u591f\u7b80\u7ec3\uff0c\u5c24\u5176\u662f\u6309\u540d\u5b57\u548c\u6309\u53f7\u7801\u67e5\u8be2\u53ef\u4ee5\u5408\u6210\u4e00\u4e2a\u51fd\u6570\u800c\u6211\u7528\u4e86\u4e24\u4e2a\uff1b<\/p>\n\n\n\n<p>contacts.h<\/p>\n\n\n\n<p><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;string>\n#include&lt;iostream>\nusing namespace std;\n\n#include&lt;fstream>\n\nclass Contacts\n{\npublic:\n\tContacts(); \/\/\u6784\u9020\u51fd\u6570\nprivate:\n\tvoid UI(); \/\/\u6b22\u8fce\u754c\u9762\n\tvoid Read(); \/\/\u4ece\u6587\u4ef6\u8bfb\u53d6\u6570\u636e\n\tvoid SearchName(string); \/\/\u6309\u540d\u5b57\u641c\u7d22\n\tvoid SearchNum(string); \/\/\u6309\u53f7\u7801\u641c\u7d22\n\tvoid Insert(string, string); \/\/\u63d2\u5165\u8bb0\u5f55\n\tvoid ShowAllRecord(); \/\/\u6253\u5370\u5168\u90e8\u8bb0\u5f55\n\tvoid DeleteName(string); \/\/\u6309\u540d\u5b57\u5220\u9664\n\tvoid DeleteNum(string); \/\/\u6309\u53f7\u7801\u5220\u9664\n\tvoid DeleteMenu(); \/\/\u5220\u9664\u83dc\u5355\n\tvoid Save(); \/\/\u4fdd\u5b58\u6570\u636e\u5230\u6587\u4ef6\n\tvoid SearchRecordMenu(); \/\/\u641c\u7d22\u8bb0\u5f55\u83dc\u5355\n\tvoid InsertRecordMenu(); \/\/\u63d2\u5165\u8bb0\u5f55\u83dc\u5355\n\ttypedef struct Record\n\t{\n\t\tstring name;\n\t\tstring phonenum;\n\t} Record; \/\/\u4e00\u6761\u8bb0\u5f55\u5305\u62ec\u540d\u5b57\u548c\u53f7\u7801\n\ttypedef struct ListNode\n\t{\n\t\tRecord record;\n\t\tListNode *next;\n\t\tListNode()\n\t\t{\n\t\t\tnext = NULL;\n\t\t}\n\t} ListNode; \/\/\u5355\u6761\u8bb0\u5f55\u8282\u70b9\n\ttypedef struct List\n\t{\n\t\tListNode *firstrecord;\n\t\tint listlen;\n\t\tList()\n\t\t{\n\t\t\tlistlen = 0;\n\t\t\tfirstrecord = NULL;\n\t\t}\n\t} List; \/\/\u901a\u8baf\u5f55\u7684\u8868\u5b58\u50a8\u7ed3\u6784\n\tList l;\n};\n\nContacts::Contacts()\n{\n\tRead();\n\tint choice;\n\twhile (1)\n\t{\n\t\tsystem(\"cls\");\n\t\tUI();\n\t\tcout &lt;&lt; \"1 . \u641c\u7d22\u8bb0\u5f55\" &lt;&lt; endl &lt;&lt; \"2 . \u63d2\u5165\u8bb0\u5f55\" &lt;&lt; endl &lt;&lt; \"3 . \u5220\u9664\u8bb0\u5f55\" &lt;&lt; endl\n\t\t\t\t&lt;&lt; \"4 . \u6240\u6709\u8bb0\u5f55\" &lt;&lt; endl &lt;&lt; \"5 . \u9000\u51fa\" &lt;&lt; endl &lt;&lt; endl;\n\t\tcout &lt;&lt; \"\u60a8\u7684\u9009\u62e9\u662f ?\" &lt;&lt; endl;\n\t\tcin >> choice;\n\t\tsystem(\"cls\");\n\t\tswitch (choice)\n\t\t{\n\t\tcase 1:\n\t\t\tSearchRecordMenu();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tInsertRecordMenu();\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tDeleteMenu();\n\t\t\tsystem(\"pause\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tsystem(\"cls\");\n\t\t\tShowAllRecord();\n\t\t\tsystem(\"pause\");\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tsystem(\"cls\");\n\t\t\tSave();\n\t\t\treturn;\n\t\t}\n\t}\n}\n\nvoid Contacts::UI() \/\/\u7528\u6237\u754c\u9762\n{\n\tcout &lt;&lt; \"************************************************************\"\n\t\t\t&lt;&lt; endl\n\t\t\t&lt;&lt; \"*                                                          *\"\n\t\t\t&lt;&lt; endl\n\t\t\t&lt;&lt; \"*                                                          *\"\n\t\t\t&lt;&lt; endl &lt;&lt; \"*            \u7b80      \u6613      \u901a      \u8baf      \u5f55            *\"\n\t\t\t&lt;&lt; endl\n\t\t\t&lt;&lt; \"*                                                          *\"\n\t\t\t&lt;&lt; endl\n\t\t\t&lt;&lt; \"*                                                          *\"\n\t\t\t&lt;&lt; endl\n\t\t\t&lt;&lt; \"************************************************************\"\n\t\t\t&lt;&lt; endl;\n}\n\nvoid Contacts::Read()\n{\n\tifstream infile;\n\tinfile.open(\"data.txt\", ios::in);\n\tif (infile != NULL)\n\t{\n\t\tstring name, num;\n\t\tListNode *p;\n\t\twhile (infile >> name >> num)\n\t\t{\n\t\t\tif (l.firstrecord == NULL)\n\t\t\t{\n\t\t\t\tl.firstrecord = new ListNode;\n\t\t\t\tl.firstrecord->record.name = name;\n\t\t\t\tl.firstrecord->record.phonenum = num;\n\t\t\t\tp = l.firstrecord;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp->next = new ListNode;\n\t\t\t\tp = p->next;\n\t\t\t\tp->record.name = name;\n\t\t\t\tp->record.phonenum = num;\n\t\t\t}\n\t\t}\n\t}\n\tinfile.close();\n}\n\nvoid Contacts::Save()\n{\n\tofstream outfile;\n\toutfile.open(\"data.txt\", ios::out);\n\tif (outfile != NULL)\n\t{\n\t\tListNode *p = l.firstrecord;\n\t\twhile (p != NULL)\n\t\t{\n\t\t\toutfile &lt;&lt; p->record.name &lt;&lt; \" \" &lt;&lt; p->record.phonenum &lt;&lt; endl;\n\t\t\tp = p->next;\n\t\t}\n\t}\n\toutfile.close();\n}\n\nvoid Contacts::SearchName(string name) \/\/\u6309\u540d\u5b57\u641c\u7d22\u8bb0\u5f55\n{\n\tsystem(\"cls\");\n\tListNode *p = l.firstrecord;\n\tbool find = false;\n\twhile (p != NULL)\n\t{\n\t\tif (p->record.name == name)\n\t\t{\n\t\t\tcout &lt;&lt; p->record.name &lt;&lt; \" : \" &lt;&lt; p->record.phonenum &lt;&lt; endl;\n\t\t\tfind = true;\n\t\t}\n\t\tp = p->next;\n\t}\n\tif (find == false)\n\t{\n\t\tcout &lt;&lt; \"\u672a\u627e\u5230\u8bb0\u5f55 !\" &lt;&lt; endl &lt;&lt; \"\u63d2\u5165\u8fd9\u6761\u8bb0\u5f55 ?(y\/n)\" &lt;&lt; endl;\n\t\tchar choice;\n\t\tstring num;\n\t\twhile (1)\n\t\t{\n\t\t\tcin >> choice;\n\t\t\tsystem(\"cls\");\n\t\t\tswitch (choice)\n\t\t\t{\n\t\t\tcase 'y':\n\t\t\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\" &lt;&lt; name &lt;&lt; \"\u7684\u7535\u8bdd\u53f7\u7801\uff1a\" &lt;&lt; endl;\n\t\t\t\tcin >> num;\n\t\t\t\tsystem(\"cls\");\n\t\t\t\tInsert(name, num);\n\t\t\t\treturn;\n\t\t\tcase 'n':\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tcout &lt;&lt; \"\u63d2\u5165\u8fd9\u6761\u8bb0\u5f55 ?(y\/n)\" &lt;&lt; endl;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid Contacts::SearchNum(string num) \/\/\u6309\u53f7\u7801\u641c\u7d22\u8bb0\u5f55\n{\n\tsystem(\"cls\");\n\tListNode *p = l.firstrecord;\n\tbool find = false;\n\twhile (p != NULL)\n\t{\n\t\tif (p->record.phonenum == num)\n\t\t{\n\t\t\tcout &lt;&lt; p->record.name &lt;&lt; \" : \" &lt;&lt; p->record.phonenum &lt;&lt; endl;\n\t\t\tfind = true;\n\t\t}\n\t\tp = p->next;\n\t}\n\tif (find == false)\n\t{\n\t\tcout &lt;&lt; \"\u672a\u627e\u5230\u8bb0\u5f55 !\" &lt;&lt; endl &lt;&lt; \"\u63d2\u5165\u8fd9\u6761\u8bb0\u5f55 ?(y\/n)\" &lt;&lt; endl;\n\t\tchar choice;\n\t\tstring name;\n\t\twhile (1)\n\t\t{\n\t\t\tcin >> choice;\n\t\t\tsystem(\"cls\");\n\t\t\tswitch (choice)\n\t\t\t{\n\t\t\tcase 'y':\n\t\t\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u53f7\u7801\" &lt;&lt; num &lt;&lt; \"\u7684\u673a\u4e3b\u59d3\u540d\" &lt;&lt; endl;\n\t\t\t\tcin >> name;\n\t\t\t\tsystem(\"cls\");\n\t\t\t\tInsert(name, num);\n\t\t\t\treturn;\n\t\t\tcase 'n':\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tcout &lt;&lt; \"\u63d2\u5165\u8fd9\u6761\u8bb0\u5f55 ?(y\/n)\" &lt;&lt; endl;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid Contacts::Insert(string name, string num) \/\/\u63d2\u5165\u8bb0\u5f55\n{\n\tListNode *p = l.firstrecord;\n\tif (p == NULL)\n\t{\n\t\tl.firstrecord = new ListNode;\n\t\tl.firstrecord->record.name = name;\n\t\tl.firstrecord->record.phonenum = num;\n\t}\n\telse\n\t{\n\t\twhile (p->next != NULL)\n\t\t\tp = p->next;\n\t\tp->next = new ListNode;\n\t\tp = p->next;\n\t\tp->record.name = name;\n\t\tp->record.phonenum = num;\n\t}\n}\n\nvoid Contacts::ShowAllRecord()\n{\n\tListNode *p;\n\tif ((p = l.firstrecord) == NULL)\n\t{\n\t\tcout &lt;&lt; \"\u6ca1\u6709\u8bb0\u5f55 !\" &lt;&lt; endl;\n\t\treturn;\n\t}\n\twhile (p != NULL)\n\t{\n\t\tcout &lt;&lt; p->record.name &lt;&lt; \" : \" &lt;&lt; p->record.phonenum &lt;&lt; endl;\n\t\tp = p->next;\n\t}\n}\n\nvoid Contacts::SearchRecordMenu()\n{\n\tint choice;\n\tchar quit;\n\tstring name, num;\n\twhile (1)\n\t{\n\t\tcout &lt;&lt; \"\u6309\u540d\u5b57\uff081\uff09\u8fd8\u662f\u6309\u53f7\u7801\uff082\uff09\u8fdb\u884c\u641c\u7d22 ?\" &lt;&lt; endl &lt;&lt; endl;\n\t\tcin >> choice;\n\t\tsystem(\"cls\");\n\t\tswitch (choice)\n\t\t{\n\t\tcase 1:\n\t\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u60a8\u8981\u641c\u7d22\u7684\u540d\u5b57 :\" &lt;&lt; endl &lt;&lt; endl;\n\t\t\tcin >> name;\n\t\t\tsystem(\"cls\");\n\t\t\tSearchName(name);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u60a8\u8981\u641c\u7d22\u7684\u7535\u8bdd\u53f7\u7801 :\" &lt;&lt; endl &lt;&lt; endl;\n\t\t\tcin >> num;\n\t\t\tsystem(\"cls\");\n\t\t\tSearchNum(num);\n\t\t\tbreak;\n\t\t}\n\t\tcout &lt;&lt; \"\u9000\u51fa ?(y\/n)\" &lt;&lt; endl &lt;&lt; endl;\n\t\tcin >> quit;\n\t\tsystem(\"cls\");\n\t\tif (quit == 'y')\n\t\t\tbreak;\n\t\telse if (quit == 'n')\n\t\t\tcontinue;\n\t\telse\n\t\t{\n\t\t\tcout &lt;&lt; \"\u9009\u62e9\u9519\u8bef !\" &lt;&lt; endl &lt;&lt; endl;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nvoid Contacts::InsertRecordMenu()\n{\n\tchar quit;\n\tstring name, num;\n\twhile (1)\n\t{\n\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u60a8\u8981\u8bb0\u5f55\u7684\u540d\u5b57\u548c\u53f7\u7801\uff08\u4e4b\u95f4\u7528\u7a7a\u683c\u9694\u5f00\uff09 :\" &lt;&lt; endl &lt;&lt; endl;\n\t\tcin >> name >> num;\n\t\tsystem(\"cls\");\n\t\tInsert(name, num);\n\t\tcout &lt;&lt; \"\u9000\u51fa ?(y\/n)\" &lt;&lt; endl &lt;&lt; endl;\n\t\tcin >> quit;\n\t\tsystem(\"cls\");\n\t\tif (quit == 'y')\n\t\t\tbreak;\n\t\telse if (quit == 'n')\n\t\t\tcontinue;\n\t\telse\n\t\t{\n\t\t\tcout &lt;&lt; \"\u9519\u8bef !\" &lt;&lt; endl &lt;&lt; endl;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nvoid Contacts::DeleteMenu()\n{\n\tint choice;\n\tstring name, num;\n\tcout &lt;&lt; \"\u6309\u59d3\u540d\uff081\uff09\u8fd8\u662f\u6309\u53f7\u7801\uff082\uff09\u5220\u9664\u8bb0\u5f55\uff1f\" &lt;&lt; endl;\n\tcin >> choice;\n\tsystem(\"cls\");\n\tswitch (choice)\n\t{\n\tcase 1:\n\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u60a8\u8981\u5220\u9664\u7684\u59d3\u540d\uff1a\" &lt;&lt; endl;\n\t\tcin >> name;\n\t\tsystem(\"cls\");\n\t\tDeleteName(name);\n\t\tbreak;\n\tcase 2:\n\t\tcout &lt;&lt; \"\u8bf7\u8f93\u5165\u60a8\u8981\u5220\u9664\u7684\u53f7\u7801\uff1a\" &lt;&lt; endl;\n\t\tcin >> num;\n\t\tsystem(\"cls\");\n\t\tDeleteNum(num);\n\t\tbreak;\n\t}\n}\n\nvoid Contacts::DeleteName(string name)\n{\n\tListNode *pre, *p;\n\tpre = p = l.firstrecord;\n\tif (p != NULL)\n\t{\n\t\twhile (p != NULL &amp;&amp; p->record.name != name)\n\t\t{\n\t\t\tpre = p;\n\t\t\tp = p->next;\n\t\t}\n\t\tif (p == NULL)\n\t\t{\n\t\t\tcout &lt;&lt; \"\u672a\u627e\u5230\u76f8\u5e94\u8bb0\u5f55\uff01\" &lt;&lt; endl;\n\t\t\treturn;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (p->next == NULL)\n\t\t\t{\n\t\t\t\tif (pre == p)\n\t\t\t\t{\n\t\t\t\t\tl.firstrecord = NULL;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpre->next = NULL;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (pre == p)\n\t\t\t\t{\n\t\t\t\t\tl.firstrecord = l.firstrecord->next;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpre->next = p->next;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcout &lt;&lt; \"\u5220\u9664\u6210\u529f\uff01\" &lt;&lt; endl;\n\t\t}\n\t}\n}\n\nvoid Contacts::DeleteNum(string num)\n{\n\tListNode *pre, *p;\n\tpre = p = l.firstrecord;\n\tif (p != NULL)\n\t{\n\t\twhile (p != NULL &amp;&amp; p->record.phonenum != num)\n\t\t{\n\t\t\tpre = p;\n\t\t\tp = p->next;\n\t\t}\n\t\tif (p == NULL)\n\t\t{\n\t\t\tcout &lt;&lt; \"\u672a\u627e\u5230\u76f8\u5e94\u8bb0\u5f55\uff01\" &lt;&lt; endl;\n\t\t\treturn;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (p->next == NULL)\n\t\t\t{\n\t\t\t\tif (pre == p)\n\t\t\t\t{\n\t\t\t\t\tl.firstrecord = NULL;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpre->next = NULL;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (pre == p)\n\t\t\t\t{\n\t\t\t\t\tl.firstrecord = l.firstrecord->next;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpre->next = p->next;\n\t\t\t\t\tdelete p;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcout &lt;&lt; \"\u5220\u9664\u6210\u529f\uff01\" &lt;&lt; endl;\n\t}\n}\n<\/code><\/pre>\n\n\n\n<p>main.cpp<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include\"Contacts.h\"\n\nint main()\n{\n\tContacts contact;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u95f2\u6765\u65e0\u4e8b\uff0c\u505a\u4e2a\u901a\u8baf\u5f55\uff0c\u6700\u57fa\u7840\u7684\u90a3\u79cd\uff0c\u79bb\u5b9e\u7528\u5dee\u5f97\u8fdc\u4e86\uff0c\u7eaf\u7cb9\u5f53\u7ec3\u624b\u4e86\uff0c\u6240\u4ee5\u4e0d\u8981\u62b1\u6709\u4ec0\u4e48\u5e7b\u60f3\uff0c\u563f\u563f\u2026 \u4e3b\u8981\u662f\u6709\u70b9\u5fd8\u8bb0C++\u7684\u8fd0\u7b97\u7b26\u91cd\u8f7d\u4e86\uff0c\u53e6\u5916\u7531\u4e8e\u5f53\u65f6\u5b66C++\u65f6\u76f4&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"http:\/\/www.wangkaixuan.tech\/?p=372\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-06-03-play-ground"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}