here's a simple sample code...
i don't test it yet :)...
let me know the result...
void push_back(mp3Type **p_type, int _id, string _sTitle, string _artist, string _length, string _size)
{
mp3Type *p = new mp3Type;
if (&p == NULL)
return;
p->id = _id;
p->songTitle = _sTitle;
p->artist = _artist;
p->length = _length;
p->size = _size;
p->next = *p_type;
*p_type = p;
}
void delete(mp3Type *p_type, mp3Type **ret_Type)
{
mp3Type *t, *n;
t = p_type;
int id = 0;
cout<<"Enter song ID that you like to delete"<<endl;
cout<<endl;
cin>>id;
while (t != NULL)
{
if (t->id == id)
{
t = t->next;
continue; //-- pass
}
int t_id = t->id;
string t_sTitle = t->songTitle;
string t_artist = t->artist;
string t_length = t->length;
string t_size = t->size;
push_back(&n,t_id,t_sTitle,t_artist,t_length,t_size);
t = t->next;
}
*ret_Type = n;
}
//--
//-- To call delete
//-- mp3Type *main_Type, *temp_Type;
//-- delete(main_Type, &temp_Type);
//--