frntback.cpp

来自「《C/C++程序员实用大全》配套代码,适用初学C++的人员。」· C++ 代码 · 共 26 行

CPP
26
字号
#ifdef __BCPLUSPLUS__
#include <list.h>
#else
#include <list>
#endif

#include <string.h>
#include <iostream.h>

using namespace std;
typedef list<string> LISTSTR;

void main(void)
 {
   LISTSTR test;

   test.push_back("back");
   test.push_front("middle");
   test.push_front("front");
   cout << test.front() << endl;		// front
   cout << test.back() << endl;		// back
   test.pop_front();
   test.pop_back();
   cout << test.front() << endl;		// middle
 }

⌨️ 快捷键说明

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