SilverhandX

list main

Feb 22nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<iostream>
  2. #include "list.h"
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     List l;
  8.  
  9.     l.appendNode(6);
  10.     l.appendNode(19);
  11.     l.appendNode(21);
  12.  
  13.     //Display initial values
  14.     cout << "Here are the initial values:\n";
  15.     l.displayList();
  16.     cout << endl;
  17.  
  18.     //Delete middle node
  19.     cout << "Now deleting the node in the middle.\n";
  20.     l.deleteNode(19);
  21.  
  22.     //Display the list
  23.     cout << "Here are the nodes left:\n";
  24.     l.displayList();
  25.     cout << endl;
  26.  
  27.     //Insert new middle node
  28.     cout << "Inserting a new node in the middle:\n";
  29.     l.insertNode(11);
  30.  
  31.     //Display the list
  32.     cout << "Here is the new list:\n";
  33.     l.displayList();
  34.     cout << endl;
  35.  
  36.     return 0;
  37. }
Add Comment
Please, Sign In to add comment