mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-05 06:37:12 +08:00
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
41 lines
964 B
C++
41 lines
964 B
C++
/**
|
|
* File: queue.cpp
|
|
* Created Time: 2022-11-28
|
|
* Author: qualifier1024 (2539244001@qq.com)
|
|
*/
|
|
|
|
#include "../utils/common.hpp"
|
|
|
|
/* ドライバーコード */
|
|
int main() {
|
|
/* キューを初期化 */
|
|
queue<int> queue;
|
|
|
|
/* 要素エンキュー */
|
|
queue.push(1);
|
|
queue.push(3);
|
|
queue.push(2);
|
|
queue.push(5);
|
|
queue.push(4);
|
|
cout << "Queue queue = ";
|
|
printQueue(queue);
|
|
|
|
/* 先頭要素にアクセス */
|
|
int front = queue.front();
|
|
cout << "Front element of the queue front = " << front << endl;
|
|
|
|
/* 要素デキュー */
|
|
queue.pop();
|
|
cout << "Element dequeued = " << front << ", after dequeuing";
|
|
printQueue(queue);
|
|
|
|
/* キューの長さを取得 */
|
|
int size = queue.size();
|
|
cout << "Length of the queue size = " << size << endl;
|
|
|
|
/* キューが空かどうかを判定 */
|
|
bool empty = queue.empty();
|
|
cout << "Is the queue empty = " << empty << endl;
|
|
|
|
return 0;
|
|
} |