First in first out
stack uses "top()".
stack doesn't have back operation.
int main (){ queue foo,bar; foo.push (10); foo.push(20); foo.push(30); bar.push (111); bar.push(222); foo.swap(bar); while(!foo.empty()) { cout << foo.front() << " "; foo.pop(); } cout << "\n"; while(!bar.empty()) { cout << bar.front() << " "; bar.pop(); } return 0; } foo: 111 222 bar: 10 20 30