Can someone help me with my delete function? I am having trouble figuring out why my delete function is not reporting false when attempting to delete a bank id that
does not exist. Thanks.

bool Bank::RemoveBankNumber(int bankID)
{
	Bank *temp, *back;
	if (head == NULL) return false;//(isEmpty()) return;
	// Search the list for the item to delete
	temp = head;
	back = NULL;

	while((temp != NULL) && ( temp->getbankID() != bankID ))
	{
		back = temp;
		temp = temp->next;
	}
	// Check to see if the item was found
	if(temp == NULL) return false;  // Not found so return false
	else if(back == NULL) // Check to see if item is first in list
	{
		head = head->next;
		delete temp; // Dispose of the node removed from the list
	}
	else // Delete node elsewhere in the list
	{
		back->next = temp->next;
		delete temp; // Dispose of the node removed from the list
	}
	return true;	// Signal successful deletion
}

Use your debugger and put a breakpoint on line 15 of the code you posted.
When the breakpoint is hit, examine the various variables.

I do not quite know how to use the debugger. Do I just mark the line and then select debug?

what compiler are you using ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.