/* linktester.cpp is a program for testing class template LinkedList. * *************************************************************************/ #include using namespace std; #include "LinkedList.h" /*---- PART 4 ---- // f() is a function with a void f(LinkedList aList) // LinkedList value parameter { // to test the copy constructor for (int i = 1; i < 5; i++) { aList.Insert(i, 0); // Insert() into the copy cout << aList << endl; // output the copy } } ---- END PART 4 ----*/ int main() { LinkedList intList; // test the class constructor cout << "Constructing intList\n"; /* ---- PART 1 ---- cout << "Empty List: \n" << intList << endl; // test output of empty list ---- END PART 1 ----*/ /* ---- PART 2 ---- for (int i = 0; i < 9; i++) { intList.Insert(i, i/2); // test Insert() cout << intList << endl; // test output } ---- END PART 2 ----*/ /* ---- PART 3 ---- { // test destructor LinkedList anotherList; for (int i = 0; i < 26; i++) anotherList.Insert(i, char(65+i)); cout << "\nHere's another list:\n" << anotherList << endl; cout << "Now destroying this list\n"; } ---- END PART 3 ----*/ /* ---- PART 4 ---- cout << "\n\n"; f(intList); // test the copy constructor cout << "\n\nOriginal list:"; // output the original to make sure cout << intList<< endl; // it hasn't been changed. ---- END PART 4 ----*/ return 0; }