Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1.  
  2.         if ((temp->v) % 2)
  3.         {
  4.             cout << "dodaje:"<<temp->v << endl;
  5.             if (!(l->next)) { l->next = temp;
  6.             }
  7.             else
  8.             {
  9.                 current = prev = l->next;
  10.                 while (current->v <= temp->v && current->next)
  11.                 {
  12.                     prev = current;
  13.                     current = current->next;
  14.                 }
  15.                 if (current == prev) {
  16.                     if (current->v >= temp->v) { temp->next = current; l->next = temp; }
  17.                     else { current->next = temp; }
  18.                 }
  19.                 else
  20.                 {
  21.                     if (!(current->next)) { current->next = temp; }
  22.                     else {
  23.                         prev->next = temp;
  24.                         temp->next = current;
  25.                     }
  26.                 }
  27.  
  28.             }
  29.             current = prev = l->next;
  30.            
  31.             cout << endl;
  32.             l->show_list();
  33.            
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement