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

📄 use_iter.cpp

📁 不错书对C++/C程序员很有用的大家不要错过.
💻 CPP
字号:
//  If you use Visual C++, set the compile options to /GX

#ifdef __BCPLUSPLUS__
#include <iostream.h>
#include <list.h>
#else
#include <iostream>
#include <list>
#endif

using namespace std;
typedef list<int> LISTINT;

void main(void)
 {
   LISTINT listOne;
   LISTINT::iterator i;

   // Add some data
   listOne.push_front (2);
   listOne.push_front (1);
   listOne.push_back (3);

   // 1 2 3
   for (i = listOne.begin(); i != listOne.end(); ++i)
     cout << *i << " ";
   cout << endl;

   // 1 1 1 1
   for (i = listOne.end(); i != listOne.begin(); --i)
     cout << *i << " ";
   cout << endl;

 }

⌨️ 快捷键说明

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