//
// main.cpp
// Queue
//
// Created by Himanshu on 03/10/21.
//
#include <iostream>
#include <queue>
using namespace std;
int main () {
queue<int> qu;
cout<<"Enqueue(x) {10, 20, 30, 40, 50}"<<endl;
qu.push(10);
qu.push(20);
qu.push(30);
qu.push(40);
qu.push(50);
cout<<"Queue-Empty(): ";
if (qu.empty()) {
cout<<"Queue is empty"<<endl;
} else {
cout<<"Queue is not empty"<<endl;
}
cout<<"Dequeue elements..."<<endl;
while (!qu.empty()) {
cout<<qu.front()<<" ";
qu.pop();
}
cout<<endl;
cout<<"Queue-Empty(): ";
if (qu.empty()) {
cout<<"Queue is empty"<<endl;
} else {
cout<<"Queue is not empty"<<endl;
}
return 0;
}
Ly8KLy8gIG1haW4uY3BwCi8vICBRdWV1ZQovLwovLyAgQ3JlYXRlZCBieSBIaW1hbnNodSBvbiAwMy8xMC8yMS4KLy8KCgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxxdWV1ZT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluICgpIHsKICAgIAogICAgcXVldWU8aW50PiBxdTsKICAgIAogICAgY291dDw8IkVucXVldWUoeCkgezEwLCAyMCwgMzAsIDQwLCA1MH0iPDxlbmRsOwogICAgcXUucHVzaCgxMCk7CiAgICBxdS5wdXNoKDIwKTsKICAgIHF1LnB1c2goMzApOwogICAgcXUucHVzaCg0MCk7CiAgICBxdS5wdXNoKDUwKTsKCiAgICBjb3V0PDwiUXVldWUtRW1wdHkoKTogIjsKICAgIGlmIChxdS5lbXB0eSgpKSB7CiAgICAgICAgY291dDw8IlF1ZXVlIGlzIGVtcHR5Ijw8ZW5kbDsKICAgIH0gZWxzZSB7CiAgICAgICAgY291dDw8IlF1ZXVlIGlzIG5vdCBlbXB0eSI8PGVuZGw7CiAgICB9CiAgICAKICAgIGNvdXQ8PCJEZXF1ZXVlIGVsZW1lbnRzLi4uIjw8ZW5kbDsKICAgIHdoaWxlICghcXUuZW1wdHkoKSkgewogICAgICAgIGNvdXQ8PHF1LmZyb250KCk8PCIgIjsKICAgICAgICBxdS5wb3AoKTsKICAgIH0KICAgIGNvdXQ8PGVuZGw7CiAgICAKICAgIGNvdXQ8PCJRdWV1ZS1FbXB0eSgpOiAiOwogICAgaWYgKHF1LmVtcHR5KCkpIHsKICAgICAgICBjb3V0PDwiUXVldWUgaXMgZW1wdHkiPDxlbmRsOwogICAgfSBlbHNlIHsKICAgICAgICBjb3V0PDwiUXVldWUgaXMgbm90IGVtcHR5Ijw8ZW5kbDsKICAgIH0KICAgIAogIHJldHVybiAwOwp9Cgo=