Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Exemple d’assignation d’un deque à un autre

 deque
{filelink=16241}

 
#include <iostream>
#include <deque>
using namespace std;
 
int main()
{
  deque<char> deq(10), deq2;
  int i;
 
  for(i = 0; i <10; i++)
     deq[i] = i + 'A';
  cout << "Le contenu de deque1: ";
  for(i = 0; i <deq.size(); i++)
    cout << deq[i];
  cout << "n";
 
  // Assigner une partie de deque1 en deque2
  deq2.assign(deq.begin()+2, deq.end()-2);
 
  cout << "Taile de deque2: " << deq2.size() << endl;
  cout << "Le contenu de deq2: ";
  for(i = 0; i <deq2.size(); i++)
    cout << deq2[i];
 
  return 0;
}

No comments yet.

Leave a Comment