Created
May 21, 2019 22:32
-
-
Save Thiago4532/b0bdae01835ef644fa5d08de60ca69e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 | |
| cout << fila.front() << "\n"; // Retorna o valor 1 | |
| fila.pop(); | |
| cout << fila.front() << "\n"; // Retorna o valor 3 | |
| fila.pop(); | |
| cout << fila.front() << "\n"; // Retorna o valor 4 | |
| fila.pop(); | |
| cout << fila.front() << "\n"; // Retorna o valor 9 | |
| fila.pop(); | |
| // Fila vazia | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment