Well, I thought I successfully learned how to erase a user given location in a vector...but since I switched over to Visual Studio 2005... I've been getting strange bugs...
My Code...
The code underlined is where the program has a fatal error... and the VS debugger pops up... I don't really get how to use the debugger yet... but I do know that I did have a problem with the same line before... but I fixed it in Dev C++ to the line you see above. But in VS it doesn't work right in the program...Code:void Phonebook::Delete() { if(vEntries.empty()) { CLEARSCREEN; cout<<"\n\t\t\tCannot Delete...Entry list is empty!"<<endl; cout<<"\t\t\tBeing sent back to menu"; Sleep(500); cout<<"."; Sleep(500); cout<<"."; Sleep(500); cout<<"."; Sleep(500); CLEARSCREEN; return; } unsigned int ieDelete=0; cout<<"\n\t\t\tDelete which entry? ( 1 - "<<vEntries.size()<<" )"; cout<<"\n\t\t\t->: "; cin>>ieDelete; if(ieDelete == 1) { vEntries.erase(vEntries.begin()); } else if(ieDelete == vEntries.size()) { vEntries.erase(vEntries.end()); } else if(ieDelete < 1) { cout<<"\n\t\t\tChoice less than 1. Returning..."; cin.get(); CLEARSCREEN; } else if(ieDelete > vEntries.size()) { cout<<"\n\t\t\tChoice higher than number of entries. Returning..."; cin.get(); CLEARSCREEN; } else { vEntries.erase(vEntries.begin() + (ieDelete-1)); } CLEARSCREEN; }