|
void INput :: deleteemployee () {
string name;
list <CEmployee *> :: iterator it = pEmplist.begin ();
list <CEmployee *> :: iterator it_end = pEmplist.end ();
cout << "Please enter the name of the employee you want to delete:"; cin >> name; // output the name of the person to delete
while (it! = it_end) // Sequence search for the person to delete
{if ((** it) .EmpolyeeName () == name)
{pEmplist.erase (it);
// cout << "The employee information you want to delete has been deleted" << endl;
break;}
it ++;
}
if (it == it_end) // Cannot find the user to delete
cout << "sorry, there is no one that you want!" << endl;
}
I'm depressed, it still works. It doesn't work now, it seems to be pEmplist.erase (it);
list <CEmployee *> I have user information here
The masters give pointers! |
|