queue: Ajouter et supprimer des élément dans la file

Author:

 list, list
{filelink=15099}


#include 
#include 
#include

using namespace std;

int main()
{

  int tab[] = {10, 5, 6, 2, 52, 89, 32};
  queue > q_r;
  cout << "La taille initiale de la file: " << q_r.size() << endl;

  cout << "Insertion des éléments du tableau dans la file: " << endl;
  for (int i = 0; i < 7; ++i)
    q_r.push(tab[i]); //Ajout à la fin de la file

  cout << "Taille de la file après l'insertion: " << q_r.size() << endl;

  cout << "Servir 3 éléments de la file " << endl;
  for (i = 0; i < 3; ++i) {
    cout << q_r.front() << endl;
    q_r.pop();
  }
  cout << "La nouvelle taille de la file:  " << q_r.size() << endl;

  return 0;
}

 /* 

 */       

Leave a Reply

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