#include typedef int DATATYPE; struct NODE { DATATYPE val; NODE *pNext; }; class LList { public: LList(); ~LList(); bool Add(const DATATYPE &val); bool Insert(unsigned index, const DATATYPE &val); bool Delete(unsigned index); void DeleteAll(); bool IsEmpty() const; DATATYPE *Find(const DATATYPE &val) const; void Display() const; private: NODE *m_pHead; unsigned m_size; }; LList::LList() { m_pHead = NULL; m_size = 0; } LList::~LList() { NODE *pNode = m_pHead; while (pNode != NULL) { NODE *pTempNode = pNode->pNext; delete pNode; pNode = pTempNode; } } bool LList::Add(const DATATYPE &val) { NODE *pNode = new NODE; pNode->val = val; pNode->pNext = m_pHead; m_pHead = pNode; ++m_size; return m_size; } void LList::Display() const { for (NODE *pNode = m_pHead; pNode != NULL; pNode = pNode->pNext) printf("%d\n", pNode->val); } bool LList::Delete(unsigned index) { } DATATYPE * LList::Find(const DATATYPE &val) const { NODE *pNext; NODE *pNode = pNext; while (pNode) { if (pNode ->val == val) break; pNode = pNode->pNext; } return pNext; } int main(void) { LList list; for (int i = 0; i < 100; ++i) list.Add(i); list.Display(); return 0; }