Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. struct book{
  2.     double b_width;
  3.     struct book* next;
  4.     struct book* prev;
  5. };
  6.  
  7. Class Shelf
  8. {
  9.     book* pierwsza_ksiazka;
  10.     double szerokosc;
  11.     public:
  12.     Shelf(double w);
  13.     ~Shelf();
  14. }
  15.  
  16. Shelf::Shelf(double w)
  17. {
  18.     book* dummy = NULL;
  19.     pierwsza_ksiazka = dummy;
  20.     szerokosc = w;
  21.    
  22.    
  23. }
  24.  
  25.  
  26.  
  27. Shelf::~Shelf()
  28. {  
  29.     if(pierwsza_ksiazka)
  30.     {
  31.    
  32.         book* obecny=pierwsza_ksiazka;
  33.         while(obecny && obecny->next)
  34.         {
  35.             book* temp=obecny;
  36.             obecny=obecny->next;
  37.             delete temp;
  38.         }
  39.     delete obecny;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement