Skip to content

Instantly share code, notes, and snippets.

@Thiago4532
Created May 21, 2019 22:32
Show Gist options
  • Select an option

  • Save Thiago4532/383944db88418ee665ad805c370fcfd7 to your computer and use it in GitHub Desktop.

Select an option

Save Thiago4532/383944db88418ee665ad805c370fcfd7 to your computer and use it in GitHub Desktop.
#include <queue> // Biblioteca da fila
using namespace std;
int main() {
queue<int> fila; // Declara uma queue do tipo int
fila.push(1); // Insere o elemento 1 atrás na fila
fila.push(3); // Insere o elemento 3 atrás na fila
fila.push(4); // Insere o elemento 4 atrás na fila
fila.push(9); // Insere o elemento 9 atrás na fila
while(!fila.empty()) { // Enquanto a fila nao estiver vazia
cout << fila.front() << " "; // Imprime o ele
fila.pop();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment