From looking at the code, I think the code is crashing at your first for loop.
1 2 3 4
|
for (int x = 0; x < LIST_SIZE; x++)
{
myList.push_back(0);
}
|
I think you're trying to initialize the list of strings. However, you are doing this with 0, which is an int. Instead of using 0, try using two empty quotes ("").
Also, with your if an else statements, you're popping off the back of the list with each iteration of x. When you try to print the list, you may only get one item, instead of 5 which is what you're shooting for.
Lastly, in the the last for loop, all you do is print the first item in the list every time. You already have declared an iterator. I find it easier just to use that one. Here is a quick way to print the items in the list.
1 2 3 4 5 6 7
|
cout << "Your list of 5 strings is: " << endl;
iterator=myList.begin();
while (iterator!=myList.end())
{
cout << *iterator; //use the dereference operator to print what the iterator points to
iterator++;
}
|
Try messing with the way to order the list. Besides that, if it's still crashing, try declaring main as an int function that returns 0 (I'm not sure if that's necessary).
Good luck!