C++ deque push_front()

Description

C++ deque push_front()

#include <iostream>
#include <deque>
using namespace std;
int main()//from  w ww.  j a va 2s  .c o  m
{
   deque<int> deq;
   deq.push_back(30);              // push items on back
   deq.push_back(40);
   deq.push_back(50);
   deq.push_front(20);             // push items on front
   deq.push_front(10);
   deq[2] = 33;                    // change middle item
   for(int j=0; j<deq.size(); j++)
      cout << deq[j] << ' ';       // display items
   cout << endl;
   return 0;
}



PreviousNext

Related