Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add(int number)
- {
- if(!head) {
- head=new tracker;
- head->i=number;
- head->next=0;
- head->prev=0;
- tail=head;
- } else {
- tail->next=new tracker;
- tail->prev=tail;
- tail=tail->next;
- tail->i=number;
- tail->next=0;
- }
- }
- void remove(int number)
- {
- struct tracker *tmp;
- struct tracker *bla;
- tmp=head;
- int rcount=0;
- while(tmp) {
- if(tmp->i==number) {
- cout << "Found match, removing node " << rcount << " with content: " << tmp->i << endl;
- tmp->prev->next=tmp->next;
- bla=tmp->prev;
- delete tmp;
- tmp=bla;
- }
- rcount++;
- tmp=tmp->next;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement