Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

C++: Accéder par index aux valeurs des éléments d’un deque

 assert, deque
{filelink=14995}

 
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
#include <deque>
using std::cout;
using std::endl;
 
int main()
{
 
	std::deque<int>  deq(10);
 
  for (int i = 1; i <= 10; ++i)
    deq[i] = i + 5;
 
  std::deque<int>::iterator pos;
 
  for (pos=deq.begin(); pos!=deq.end(); ++pos) {
        cout << *pos << ' ';
  }
 
  return 0;
}

No comments yet.

Leave a Comment