/
githubmirror
/
hello-algo
Обзор
Документация
Войти
/
githubmirror
/
hello-algo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
en/codes/cpp/chapter_stack_and_queue/queue.cpp
41 строка
933 B
Yudong Jin
Translate all code to English (#1836)
31 дек 2025, 02:44
Не верифицирован
31 дек 2025, 02:44
2778a6f
Код
Авторство
О чём код?
/** * File: queue.cpp * Created Time: 2022-11-28 * Author: qualifier1024 (2539244001@qq.com) */ #include "../utils/common.hpp" /* Driver Code */ int main() { /* Access front of the queue element */ queue<int> queue; /* Elements enqueue */ queue.push(1); queue.push(3); queue.push(2); queue.push(5); queue.push(4); cout << "Queue queue = "; printQueue(queue); /* Return list for printing */ int front = queue.front(); cout << "Front element front = " << front << endl; /* Element dequeue */ queue.pop(); cout << "Dequeue element front = " << front << ", after dequeue, queue = "; printQueue(queue); /* Get the length of the queue */ int size = queue.size(); cout << "Queue length size = " << size << endl; /* Check if the queue is empty */ bool empty = queue.empty(); cout << "Queue is empty = " << empty << endl; return 0; }