mramine364

LinkedList Main (examples)

Sep 4th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<iostream>
  2. #include"LinkedList.h"
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.    
  8.     LinkedList* list = new LinkedList;
  9.  
  10.     list->unshift(27);  list->unshift(12);  list->unshift(56);
  11.     list->push(87); list->push(35); list->unshift(25);
  12.    
  13.     cout << "list=" << *list << endl;
  14.  
  15.     LinkedList* clist = list->copy(1, 5);
  16.     cout << "clist=" << *clist << endl;
  17.  
  18.     LinkedList* slist = list->splice(2, 4);
  19.     cout << "slist=" << *slist << endl;
  20.     cout << "remained list=" << *list << endl;
  21.  
  22.     cout << "find 25=" << clist->find(56) << endl;
  23.     cout << "find 100=" << clist->find(100) << endl;
  24.  
  25.     clist->sort();
  26.     cout << "sorted clist=" << *clist << endl;
  27.  
  28.     delete list;
  29.     delete clist;
  30.     delete slist;
  31.  
  32.     getchar();
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment