Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. //insere um novo elemento no próximo espaço vazio da fila
  2.     public void inserir(int elemento){
  3.        
  4.         //se proximo vazio for igual a -1 ou quantidade de espaços vazios for menor ou igual ao tamanho da fila
  5.         if(prox == -1 || (vazio <= fila.length && vazio != 0)){
  6.             fila[prox+1] = elemento;
  7.             prox++;
  8.             vazio--;
  9.         }else if(vazio == 0){
  10.             System.out.println("A fila está cheia");
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement