I'm supposed to make a queue
of vector
s to solve a part of my assignment.
However, I do not know how to access my vector stored in the queue (for debugging purposes). I cannot just loop through the queue and cout
vectors.
How do I print out all elements of vector
s that has been stored in queue
?
Here is the smaller copy of the code:
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
string start = "cat";
string end = "hog"
// Initialization of queue for BFS
queue<vector<string>> chains;
// Pushing the starting word in queue chains
vector<string> init;
init.push_back(start);
chains.push(init);
// I cannot cout vectors
while (!chains.empty()) {
cout << chains.front() << endl;
chains.pop();
}
}
Thanks for your time!