deque.cpp
来自「C++ sample code, for the book: C++ blac」· C++ 代码 · 共 44 行
CPP
44 行
#include <deque>
#include <string>
#include <iostream>
using namespace std;
deque<string> patients;
int main ()
{
cout << "Initializing patients..." << endl;
patients.push_front("Frank");
patients.push_front("Molly");
patients.push_front("Tom");
patients.push_front("Sally");
deque<string>::iterator itr;
itr = patients.begin();
while (itr < patients.end())
cout << *itr++ << endl;
cout << "Third patient..." << endl;
cout << patients[2] << endl;
cout << "A new patient arrives..." << endl;
patients.push_back("Kurt");
itr = patients.begin();
while (itr < patients.end())
cout << *itr++ << endl;
cout << "Seeing the first patient..." << endl;
patients.pop_front();
itr = patients.begin();
while (itr < patients.end())
cout << *itr++ << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?