c++相关

c++ queue的使用

2017-03-04  本文已影响0人  HenryTien
#include <iostream>
using namespace std;
#include <queue>
#define  N 10
int main() {
    queue<int> que;
    for (int i = 0; i < N; i++)
    {
        que.push(i);
        cout << que.back() << "准备入队" << endl;
    }
    cout << "que size: " << que.size() << endl;
    for (int i = 0; i < N; i++)
    {
        cout << "准备出队" << que.front() << endl;
        que.pop();
    }
    cout << "que size: " << que.size() << endl;
    system("pause");
    return 0;
}
上一篇下一篇

猜你喜欢

热点阅读