C++简单的容器 deque

#include<iostream>
#include<deque>
using namespace std;
int main()
{
    deque<int> a[10];
    
    a[2].push_back(2);
    a[2].push_back(3);
    a[2].push_back(4);
    a[2].push_front(1);
    a[0].push_back(2);
    a[1].push_back(2);
    a[9].push_back(2);
    
    for (int i = 0;i < 10;i ++)
    {
        if (!a[i].empty())
        {
            for (int j = 0;j < 10;j ++)
            {
                cout << a[i][j] << ' ';
            }
            cout << endl;
        }
        else
        {
            cout << "empty" << endl;
        }
    }

    return 0;
}
posted @ 2021-12-19 16:39  riz9  阅读(25)  评论(0编辑  收藏  举报