C++: Inverser le contenu d’un deque

Author:

 assert, deque
{filelink=14993}


#include 
#include 
#include 
#include 
#include  // pour la fonction reverse
using namespace std;

int main()
{

deque deq;
for(int x=0;x<26;x++)
   deq.push_back(x+'A');

  deque::iterator i;

  for (i = deq.begin(); i != deq.end(); ++i)
    cout << *i;

  cout << "n";

  //Inverser le contenu
  reverse(deq.begin(), deq.end());

  for (i = deq.begin(); i != deq.end(); ++i)
    cout << *i;

  return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *