This:
vector<string> journal;
is recreated on each iteration of the while
loop so when the code that prints the elements operates on a new empty vector
. Move the definition of journal
to outside of the while
loop:
vector<string> journal;
while (running) // Note removed assignment here.
{
}
And the hardcoded values that are push_back()
ed into the vector
may also need to moved outside of the loop if you do not want these repeatedly added.