I'm working on an assignment, writing a simple RPG program using a vector and an algorithm. I am having an issue getting my program to function properly and I am sure that my mistake is a simple one but I haven't been able to get any help from my teacher on this and I don't know where to turn at this point! At this part of my code:
for (iter1=weapon.begin();iter1 != weapon.end(); ++iter1)
cout << "Today " << name << " chose: " << *iter1 << "to slay the Zombies!!\n\n";
clearly the code will spit out each different weapon with what is listed in the cout << "Today" ........etc. I want to be able to pick from a list of weapons. However, when I go to change to a constant iterator, I get an abort error telling me my iterator is not dereferencable. I am at a loss as my first vector in the program worked just fine but this one will not. Any help at all would be greatly appreciated!