SHARE
TWEET

Untitled

s3nnou May 19th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void firstFileElementDelete(listFirstFile *& headFirstFile, listFirstFile *& tailFirstFile, int &sizeOf_FirstFile) {
  2.     int c;
  3.     numericInputChecker(c);
  4.  
  5.     listFirstFile *temp = new listFirstFile;
  6.     listFirstFile *tempHead = headFirstFile;
  7.  
  8.     if ((c == 1) and (headFirstFile->next)) {
  9.         temp = headFirstFile;
  10.         headFirstFile = headFirstFile->next;
  11.         headFirstFile->prev = NULL;
  12.         delete temp;
  13.         sizeOf_FirstFile--;
  14.         return;
  15.     }
  16.     else if ((c == 1) and (headFirstFile == tailFirstFile)) {
  17.  
  18.         headFirstFile->next = NULL;
  19.         headFirstFile = NULL;
  20.         delete headFirstFile;
  21.         sizeOf_FirstFile--;
  22.         return;
  23.     }
  24.  
  25.     if (c == sizeOf_FirstFile) {
  26.         temp = tailFirstFile;
  27.         tailFirstFile = tailFirstFile->prev;
  28.         tailFirstFile->next = NULL;
  29.         delete temp;
  30.         sizeOf_FirstFile--;
  31.         return;
  32.     }
  33.  
  34.  
  35.     for (int i = 0; i <= c; i++) {
  36.         tempHead = tempHead->next;
  37.     }
  38.  
  39.     temp = tempHead;
  40.     temp->prev->next = tempHead->next;
  41.     temp->next->prev = tempHead->prev;
  42.     delete tempHead;
  43.     sizeOf_FirstFile--;
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top