void Person::SearchDelete(int numDelAccount)
{
for (unsigned int i=0; i < accounts.size(); i++)
{
if(accounts[i]->getaccountNumber()==numDelAccount)
{
accounts.erase(i);
}
}
}
I have written this to delete a specified account number "numDelAccount" by searching the array of accounts, but when I run it, it says "account deleted" after apparently using the SearchDelete function, but when I check the accounts list upon returning to the menu, it has not deleted the account, can someone tell me what I am missing?