Queue-all queue functions

////////////////////////////////////////
//      2018/05/08 22:49:21
//      Queue-all queue functions

// Queue is a container adapter that gives  the programmer  a FIFO (first-in,first-out)
// data structure

// push,pop,size,front,back,empty

#include <iostream>
#include <queue>
#include <string>

using namespace std;

int main(){
    string s1("C++");
    string s2("is");
    string s3("powerfull");
    string s4("language");

    queue<string> que;
    que.push(s1);
    que.push(s2);
    que.push(s3);
    que.push(s4);

    cout << "size of queue 'que' = " << que.size() << endl;

    string temp = que.back();
    cout << temp << endl;


    while (!que.empty()){
        temp = que.front();
        cout << temp << " ";
        que.pop();
    }
    cout << endl;

    return 0;
}


/*
OUTPUT:
    size of queue 'que' = 4
    language
    C++ is powerfull language
*/ 
原文地址:https://www.cnblogs.com/laohaozi/p/12537810.html