how to insert in a queue c++
#include <iostream> #include <queue> using namespace std; int main() { queue<int> q; for (int i = 1; i <= 5; i++) { // this is how you insert elements in the queue q.push(i); } // runs till the queue is empty while (!q.empty()) { // get the first value from the queue int value = q.front(); // print the value cout << "value: " << value << endl; // remove the front value, so that we can get the next value q.pop(); } return 0; }