e06-03.cpp
来自「游戏开发数据结构Data Structures for Game Program」· C++ 代码 · 共 34 行
CPP
34 行
// =======================================================
// 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 + =
减小字号Ctrl + -
显示快捷键?