⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e06-03.cpp

📁 游戏开发数据结构Data Structures for Game Programmers
💻 CPP
字号:
// =======================================================
//  Chapter 6, Example 3
//  Using the SLinkedList and SListIterator classes
// =======================================================
#include "SLinkedList.h"
#include <iostream.h>


void main()
{
    // create a new linked list.
    SLinkedList<int> list;

    // insert 10, 20 and 30.
    list.Append( 10 );
    list.Append( 20 );
    list.Append( 30 );

    cout << "the list contains: ";

    // create a new iterator, and make it point to the
    // beginning of the list.
    SListIterator<int> itr = list.GetIterator();

    
    // loop through the list while the iterator is valid.
    for( itr.Start(); itr.Valid(); itr.Forth() )
    {
        cout << itr.Item() << ", ";
    }

    // reset the iterator to the beginning again.
    itr.Start();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -