Originally Posted by shabbir
What is the problem you are facing when trying to delete the 2nd node.
I'm not too sure what the problem is but it won't allow me to delete the 2nd node. I tried another piece of code but now when i try to delete node 1, it deletes node 8 (the last node), and if i delete node 8, nothing happens.
The code is here: Keep in mind that current is the head pointer pointing to the first node. Disregard my linker and longlinker pointer, that's doing something else. x is the node which the user chooses to delete. Shortlink is the pointer that points the node to the next node.

void ring::remove(int x)
node* prev = current -> shortlink;
node* cur = current;
node* linker = current;
node *longlinker = current;

 //cur = prev;
 for (int j = 1; j < length; j++)
 linker = linker -> shortlink;
 for (int k = 1; k < length; k++)
 longlinker = longlinker -> shortlink;

 for (int i=1; i < length ; i++)

 if (prev -> num == x)
  cur -> shortlink = prev -> shortlink ;
  linker = prev -> shortlink;
  longlinker -> longlink= prev -> longlink;
  delete prev;
  cur = prev;
  prev = prev -> shortlink;