stl-stack.cc

来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架&gt」· CC 代码 · 共 33 行

CC
33
字号
// Filename: STL-stack.cc// Adapting a stack from a vector#include <iostream>#include <vector>#include <stack>#include <string>using namespace std;int main() {    stack<string, vector<string> > strStack;    string quote[3] = {                          "Any food that starts out hard will soften when stale.\n",                          "Any food that starts out soft will harden when stale.\n",                          "Isaac's Strange Rule of Staleness\n"                      };    for (int i =0; i < 3; ++i)        strStack.push(quote[i]);    while (!strStack.empty()) {        cout << strStack.top();        strStack.pop();    }}/*outOOP> gpp STL-stack.ccOOP> a.outIsaac's Strange Rule of StalenessAny food that starts out soft will harden when stale.Any food that starts out hard will soften when stale.OOP>*/

⌨️ 快捷键说明

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