#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main()
{
queue<string> queueObject;
queueObject.push("one");
queueObject.push("two");
queueObject.push("three");
cout << "Contents of queue: ";
for(int i = 0; i < queueObject.size(); i++) {
cout << queueObject.front() << " ";
// remove front and push on back
queueObject.push( queueObject.front() );
queueObject.pop();
}
cout << endl;
cout << "Now, remove elements:\n";
while( !queueObject.empty() ) {
cout << "Popping ";
cout << queueObject.front() << endl;
queueObject.pop();
}
return 0;
}
|