Posted By

itsok2kry on 10/17/08


Tagged

list c linked working not


Versions (?)

Linked List (Tester.cpp)


 / Published in: C++
 

this doesn't work at all.

  1. #include <iostream>
  2. #include "LinkedList.h"
  3. #include "LinkedNode.h"
  4.  
  5. int main()
  6. {
  7. // our list
  8. LinkedList< int > list;
  9.  
  10. //add a couple values
  11. list.add( 1000 );
  12. list.add( 2000 );
  13.  
  14. // try to get them back out
  15. int val1 = list.get( 1 );
  16. int val2 = list.get( 2 );
  17.  
  18. // output the result and wait for input
  19. std::cout << "val1: " << val1 << std::endl;
  20. std::cout << "val2: " << val2 << std::endl;
  21. std::cout << "list size: " << list.getSize() << std::endl;
  22.  
  23. std::cin.ignore( std::cin.rdbuf()->in_avail() + 1 );
  24.  
  25. return 0;
  26. }

Report this snippet  

You need to login to post a comment.