32 lines
477 B
Plaintext
32 lines
477 B
Plaintext
|
#include <iostream>
|
||
|
#include <queue>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
|
||
|
// create a queue of string
|
||
|
queue<string> animals;
|
||
|
|
||
|
// push elements into the queue
|
||
|
animals.push("Cat");
|
||
|
animals.push("Dog");
|
||
|
|
||
|
cout << "Queue: ";
|
||
|
|
||
|
// print elements of queue
|
||
|
// loop until queue is empty
|
||
|
while(!animals.empty()) {
|
||
|
|
||
|
// print the element
|
||
|
cout << animals.front() << ", ";
|
||
|
|
||
|
// pop element from the queue
|
||
|
animals.pop();
|
||
|
}
|
||
|
|
||
|
cout << endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|