Advertisement
Guest User

DoubleLinkedList

a guest
Jul 2nd, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. struct TElem
  2. {
  3.     struct TInfo
  4.     {
  5.         char name[30], surname[30], patr[30];
  6.         int day, month, year;
  7.     } info;
  8.     TElem *next, *prev;
  9. };
  10.  
  11. void deleteIncorrect(TElem *first)
  12. {
  13.     TElem *current = first;
  14.     TElem *temp;
  15.     while(current != nullptr)
  16.     {
  17.         if (1 > current->info.month || current->info.month > 12 || 1 > current->info.day || current->info.day > daysInMonthes[info.month-1])
  18.         {
  19.             current->prev->next = current->next;
  20.             current->next->prev = current->prev;
  21.             temp = current->prev;
  22.             delete current;
  23.             current = temp;
  24.         }
  25.         current = current->next;
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement