No Description

main.cpp 684B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <iostream>
  2. #include "Llist.h"
  3. using namespace std;
  4. int main() {
  5. Llist L;
  6. L.insertAfter(NULL, 9);
  7. L.insertAfter(NULL, 5);
  8. // L.append(9);
  9. L.append(42);
  10. L.prepend(3);
  11. L.prepend(1);
  12. L.insertAfter(L.search(9),55);
  13. L.insertAfter(L.search(55),85);
  14. L.insertAfter(L.search(3),3);
  15. L.insertAfter(L.search(3),7);
  16. cout << L << endl;
  17. // L.printRev();
  18. L.removeAfter(L.search(9));
  19. cout << L << endl;
  20. Llist M(L);
  21. // Llist M;
  22. // M = L;
  23. cout << M << endl;
  24. M.append(19);
  25. M.prepend(119);
  26. M.insertAfter(M.search(3),59);
  27. cout << M << endl;
  28. cout << L << endl;
  29. while (L.getLength() > 0) {
  30. L.removeAfter(NULL);
  31. cout << L << endl;
  32. }
  33. }