Hi, I'm writing a program where I have to use a vector to store the name of visitors to a hospital. The program will let you view the list of visitors, add a name, check to see if a name is on the list, and remove a name from the list. I'm having trouble figuring out how to check if a name is on the list, and how to remove a name from the list. This is my first time using vectors and am finding it extremely difficult. If I comment out these two sections of codes, where choice ==3, and choice == 4, I can view the list and add to it! If anyone could help me out that would be great! Here is the code:
Also in line 41 find and search both return iterators so you don't need to dereference find_name
Same for find_name in line 42.
Line 53 you can't assign an iterator from a value like that. Use std::find.
Line 54 you don't need to dereference delete_names, you are using the assignment operator instead we need to use the not equal to operator, and you want to compare it to names.end().
Line 55 You don't need to dereference delete_name since erase takes an iterator argument.
Hmm, that didn't seem to work, I keep getting a crazy error that is taking up the whole VIM screen when I compile. I'm gonna see if I can figure it out! Thanks for the articles though, they were helpful!