01: #include <iostream>
02: #include <string>
03: #include <queue>
04: #include <stack>
06: using namespace std;
07: 
08: int main()
09: {  cout << "FIFO order:\n";
11: 
12:    queue<string> q;
13:    q.push("Tom");
14:    q.push("Dick");
15:    q.push("Harry");
16: 
17:    stack<string> s;
18:    while (q.size() > 0)
19:    {  string name = q.front();
21:       q.pop();
22:       cout << name << "\n";
23:       s.push(name);
24:    }
26:    cout << "LIFO order:\n";
28:    while (s.size() > 0)
29:    {  cout << s.top() << "\n";
31:       s.pop();
32:    }
34:    return 0;
35: }