Erase is not working

void erase(string key)
{
int idx=hash_fun(key);
Nodetemp=table[idx];
if(temp->key==key)
{
table[idx]=temp->next;
cout<<endl<<“Deleted”;
return;
}
while(temp!=NULL)
{
if(temp->next&&temp->next->key==key)
{
Node
temp1=temp->next;
temp->next=temp->next->next;
delete temp1;
cout<<endl<<“deleted”;
return;
}
cout<<endl<key;
temp=temp->next;
}
cout<<endl<<“Element not found”;
}

sir will u want to explain what are u trying to do in the above code
if possible provide the entire code for the hash u have implemented

acc. to me
just if the key is found then uss key ke next ko NULL kar do and key ki value empty kr do

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.