DarkSpect

Ordena

Feb 2nd, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. void Caixa:: ordenafila(Cliente &cl){
  2.     if(!c.vazia()){         //c é a Queue<Cliente*>
  3.         if(typeid(cl)!=typeid(Prestacao)){
  4.             if(typeid(c.ultimo)!=typeid(Pronto)){
  5.                 boolean flag=false;
  6.                 int cmp=c.comprimento();
  7.                 Cliente *aux;
  8.                 while(!flag){
  9.                     c.retira(aux);
  10.                     if(typeid(aux)==typeid(Prestacao)){
  11.                         c.insere(cl);
  12.                         flag=true;
  13.                     }
  14.                     c.insere(aux);
  15.                     cmp--;
  16.                 }
  17.                 for(int i=0;i<cmp;i++){
  18.                     c.retira(aux);
  19.                     c.insere(aux);
  20.                 }
  21.             }else
  22.                 c.insere(cl);
  23.         }else
  24.             c.insere(cl);
  25.     }else
  26.         c.insere(cl);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment