Demonstrate the queue class: push, front, empty and pop
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main()
{
queue<string> queueObject;
cout << "Pushing one two three four\n";
queueObject.push("one");
queueObject.push("two");
queueObject.push("three");
while(!queueObject.empty()) {
cout << "Popping ";
cout << queueObject.front() << endl;
queueObject.pop();
}
return 0;
}
Related examples in the same category