Hey I'm having trouble with a HW assignment, no need to give me the answer out right but any help would be appreciated!
I'm just trying to search a linked list and find a node then delete it. Here is what I have so far:
void deleteSong()
{
char deleteMe[sz];
bool found = false;
Node* Scan = playList.GetFirstNode();
Song* Check;
cin.ignore();
cout << "Enter the song path you would like to delete: ";
cin.getline(deleteMe,sz);
Check = new Song(deleteMe);
if(Scan==0)
{
cout << "Nothing in list" << endl;
return;
}
else
{
while(Scan!=0 && !found)
{
if(Scan->data_ == Check->GetSongName())
{
playList.RemoveThisLink(Scan);
found = true;
cout << "DELETED" << endl;
}
else
{
cout << "SCANNING" << endl;
Scan = Scan->next_;
}
}
}
}
The code compiles fine, it just doesn't find a hit at this if statement: if(Scan->data_ == Check->GetSongName())
Please tell me if you would like me to supply anymore code.