亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? appxe01.cpp

?? 《21天學通C++》Teach Yourself C++ in 21 Days (Fourth Edition) 源代碼
?? CPP
字號:
// ***********************************************
//    FILE:        Listing 13E.13
//    PURPOSE:    Demonstrate ilinked list
//    NOTES:
//
//  COPYRIGHT:  Copyright (C) 2000-04 Liberty Associates, Inc.
//                All Rights Reserved
//
// Demonstrates an object-oriented approach to
// linked lists. The list delegates to the node.
// The node is an abstract data type. Three types of
// nodes are used, head nodes, tail nodes and internal
// nodes. Only the internal nodes hold data.
//
// The Data class is created to serve as an object to
// hold in the linked list.
//
// ***********************************************
 
 
#include <iostream>
using namespace std;
 
enum { kIsSmaller, kIsLarger, kIsSame};
 
// Data class to put into the linked list
// Any class in this linked list must support two methods:
// Show (displays the value) and 
// Compare (returns relative position)
class Data
{
  public:
    Data(int val):myValue(val){}
    ~Data(){}
    int Compare(const Data &);
    void Show() { cout << myValue << endl; }
  private:
    int myValue;
};
 
// Compare is used to decide where in the list
// a particular object belongs.
int Data::Compare(const Data & theOtherData)
{
    if (myValue < theOtherData.myValue)
       return kIsSmaller;
    if (myValue > theOtherData.myValue)
       return kIsLarger;
    else
       return kIsSame;
}
 
// forward declarations
class Node;
class HeadNode;
class TailNode;
class InternalNode;
 
// ADT representing the node object in the list
// Every derived class must override Insert and Show
class Node
{
   public:
     Node(){}
     virtual ~Node(){}
     virtual Node * Insert(Data * theData)=0;
     virtual void Show() = 0;
   private:
};
 
// This is the node which holds the actual object
// In this case the object is of type Data
// We'll see how to make this more general when
// we cover templates
class InternalNode: public Node
{
   public:
     InternalNode(Data * theData, Node * next);
     ~InternalNode(){ delete myNext; delete myData; }
     virtual Node * Insert(Data * theData);
     // delegate!
     virtual void Show() { myData->Show(); myNext->Show(); }  
 
   private:
     Data * myData;  // the data itself
     Node * myNext;    // points to next node in the linked list
};
 
// All the constructor does is to initialize
InternalNode::InternalNode(Data * theData, Node * next):
myData(theData),myNext(next)
{
}
 
// the meat of the list
// When you put a new object into the list
// it is passed ot the node which figures out
// where it goes and inserts it into the list
Node * InternalNode::Insert(Data * theData)
{
 
    // is the new guy bigger or smaller than me?
    int result = myData->Compare(*theData);
 
 
    switch(result)
    {
    // by convention if it is the same as me it comes first
    case kIsSame:        // fall through
    case kIsLarger:    // new data comes before me
       {
          InternalNode * dataNode = new InternalNode(theData, this);
          return dataNode;
       }
 
    // it is bigger than I am so pass it on to the next
    // node and let HIM handle it.
    case kIsSmaller:
       myNext = myNext->Insert(theData);
       return this;
    }
    return this;  // appease MSC
}
 
 
// Tail node is just a sentinel
 
class TailNode : public Node
{
   public:
     TailNode(){}
     ~TailNode(){}
     virtual Node * Insert(Data * theData);
     virtual void Show() { }
 
   private:
 
};
 
// If data comes to me, it must be inserted before me
// as I am the tail and NOTHING comes after me
Node * TailNode::Insert(Data * theData)
{
    InternalNode * dataNode = new InternalNode(theData, this);
    return dataNode;
}
 
// Head node has no data, it just points
// to the very beginning of the list
class HeadNode : public Node
{
   public:
     HeadNode();
     ~HeadNode() { delete myNext; }
     virtual Node * Insert(Data * theData);
     virtual void Show() { myNext->Show(); }
   private:
     Node * myNext;
};
 
// As soon as the head is created
// it creates the tail
HeadNode::HeadNode()
{
 	myNext = new TailNode;
}
 
// Nothing comes before the head so just
// pass the data on to the next node
Node * HeadNode::Insert(Data * theData)
{
    myNext = myNext->Insert(theData);
    return this;
}
 
// I get all the credit and do none of the work
class LinkedList
{
   public:
     LinkedList();
     ~LinkedList() { delete myHead; }
     void Insert(Data * theData);
     void ShowAll() { myHead->Show(); }
   private:
     HeadNode * myHead;
};
 
// At birth, I create the head node
// It creates the tail node
// So an empty list points to the head which
// points to the tail and has nothing between
LinkedList::LinkedList()
{
    myHead = new HeadNode;
}
 
// Delegate, delegate, delegate
void LinkedList::Insert(Data * pData)
{
    myHead->Insert(pData);
}
 
// test driver program
int main()
{
    Data * pData;
    int val;
    LinkedList ll;
 
    // ask the user to produce some values
    // put them in the list
    for (;;)
    {
       cout << "What value? (0 to stop): ";
       cin >> val;
       if (val == 0)
          break;
       pData = new Data(val);
       ll.Insert(pData);
    }
 
    // now walk the list and show the data
    ll.ShowAll();
    return 0;  // ll falls out of scope and is destroyed!
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99视频精品免费视频| 国产不卡高清在线观看视频| 欧美色网站导航| 日日夜夜一区二区| 精品免费视频一区二区| 国模大尺度一区二区三区| 欧美国产精品一区二区| 色88888久久久久久影院野外| 亚洲综合精品自拍| 欧美一区二区三区成人| 韩国午夜理伦三级不卡影院| 国产欧美日韩在线视频| av激情成人网| 亚洲va中文字幕| 久久一二三国产| 91视频在线看| 日韩av一二三| 国产精品第一页第二页第三页| 一本一道久久a久久精品| 首页欧美精品中文字幕| 久久精品日韩一区二区三区| 91丨porny丨中文| 日本不卡一区二区| 欧美韩日一区二区三区| 欧美曰成人黄网| 久久99久久精品| 亚洲男人都懂的| 欧美成人伊人久久综合网| 成人黄色av电影| 亚洲国产精品久久艾草纯爱 | 日本欧美肥老太交大片| 欧美激情综合网| 欧美日韩国产一级二级| 国产高清精品网站| 香蕉av福利精品导航| 国产色一区二区| 欧美精品亚洲二区| 99精品欧美一区二区三区小说 | 99久久伊人网影院| 亚洲已满18点击进入久久| 久久影院午夜论| 69堂国产成人免费视频| 99国产精品一区| 国产麻豆欧美日韩一区| 日韩精品免费专区| 一区二区三区在线免费播放| 国产三级一区二区三区| 欧美片网站yy| 在线视频欧美区| 成人免费高清在线| 国产麻豆精品视频| 日韩av一区二区三区| 洋洋av久久久久久久一区| 国产精品美女一区二区三区| 日韩欧美的一区| 欧美午夜片在线看| 色狠狠综合天天综合综合| 国产成人精品免费网站| 久久99国产精品麻豆| 亚洲一区二区偷拍精品| 亚洲欧美自拍偷拍色图| 国产欧美一区视频| 国产亚洲精品久| 精品国产制服丝袜高跟| 欧美一区三区二区| 51精品国自产在线| 欧美日韩国产精选| 欧美肥大bbwbbw高潮| 欧美日韩国产综合视频在线观看| 色哟哟在线观看一区二区三区| 波多野结衣中文一区| 成人午夜电影网站| 成人看片黄a免费看在线| 风流少妇一区二区| 国产成人免费视频一区| 国产伦精品一区二区三区免费| 欧美aaaaa成人免费观看视频| 日韩综合在线视频| 蜜桃av一区二区三区| 久久国产精品免费| 国产一区二区按摩在线观看| 国产精品一区二区在线观看不卡| 国产露脸91国语对白| 成人网男人的天堂| 一本色道久久加勒比精品| 在线看国产一区| 777奇米成人网| 欧美成人综合网站| 国产香蕉久久精品综合网| 国产精品久久久久aaaa樱花| 亚洲三级在线观看| 婷婷六月综合网| 久草中文综合在线| 成人综合婷婷国产精品久久免费| 成人的网站免费观看| 色婷婷精品久久二区二区蜜臂av | 精品久久久久久综合日本欧美| 日韩欧美国产综合| 国产精品三级av| 亚洲免费在线播放| 日韩av一区二| 国产精品12区| 91黄色免费版| 欧美变态口味重另类| 中文字幕制服丝袜成人av | 在线视频你懂得一区| 91精品国产aⅴ一区二区| 26uuu亚洲| 亚洲毛片av在线| 日本中文字幕一区二区有限公司| 国产精品一区二区久久精品爱涩| 国产宾馆实践打屁股91| 欧美日韩国产免费一区二区| 久久综合中文字幕| 亚洲制服丝袜av| 国产一区二区三区黄视频| 日本韩国精品在线| 欧美xxxx老人做受| 亚洲精品成a人| 国产高清不卡二三区| 欧美日韩成人综合| 国产精品久久久久久久久晋中| 日韩黄色小视频| 99久久婷婷国产综合精品电影 | 国产精品一二三区在线| 色婷婷久久一区二区三区麻豆| 精品欧美乱码久久久久久1区2区| 亚洲精品乱码久久久久| 精品亚洲aⅴ乱码一区二区三区| 色综合久久久久久久| 久久亚洲影视婷婷| 三级亚洲高清视频| 色婷婷综合在线| 国产欧美一区二区精品秋霞影院| 日韩一区精品视频| 色婷婷亚洲婷婷| 中文字幕精品综合| 久久av资源站| 91精品国产综合久久香蕉麻豆 | 国产69精品久久久久毛片| 777色狠狠一区二区三区| 亚洲欧美日韩在线| 国产精品一卡二| 日韩一区二区在线观看视频播放| 亚洲曰韩产成在线| 91老师片黄在线观看| 久久人人爽人人爽| 美女视频黄频大全不卡视频在线播放| 91电影在线观看| 亚洲欧洲日韩一区二区三区| 国产黄色精品网站| 久久人人超碰精品| 国产乱色国产精品免费视频| 精品国产伦一区二区三区观看体验 | 国产成+人+日韩+欧美+亚洲| 精品日韩成人av| 狂野欧美性猛交blacked| 3d成人动漫网站| 午夜精品久久一牛影视| 欧美亚洲一区二区在线观看| 亚洲欧美日韩国产综合| 99在线热播精品免费| 国产精品国产三级国产aⅴ原创| 成人自拍视频在线观看| 国产三级三级三级精品8ⅰ区| 国产成人啪午夜精品网站男同| 精品国产在天天线2019| 国产精品1区2区3区| 日本一区二区免费在线观看视频 | 91在线观看一区二区| 亚洲日本欧美天堂| 91久久精品一区二区二区| 亚洲品质自拍视频| 欧美色综合久久| 日本视频中文字幕一区二区三区| 日韩一区二区三区高清免费看看| 另类的小说在线视频另类成人小视频在线| 91精品国产综合久久精品图片| 男女男精品视频网| 久久综合九色综合欧美98| 懂色av一区二区夜夜嗨| 国产精品国产自产拍高清av王其| 一本色道久久综合亚洲91| 亚洲成av人片在线观看| 69精品人人人人| 国产高清无密码一区二区三区| 国产精品理论片在线观看| 91网站在线播放| 日韩av在线发布| 国产三级久久久| 欧美色视频在线观看| 久久福利资源站| 1024成人网| 91精品一区二区三区久久久久久 | 亚洲一区二区三区国产| 正在播放亚洲一区| 国产成人免费在线视频| 亚洲午夜一区二区| 久久久久国产免费免费 | 亚洲成人av福利|