Programming

profileKkle
listTest.cpp

#include <iostream> #include "listType.h" using namespace std; int main() { listType firstList; listType secondList; firstList.add(3); firstList.add(10); secondList.add(3); secondList.add(4); secondList.add(10); if (firstList.isEqual(secondList)) cout << "They are the same!" << endl; else cout << "The lists are different" << endl; cout << "The contents of the first list are: "; firstList.print(); cout << "The contents of the second list are: "; secondList.print(); cout << "Assigned the second list to the first list." << endl; firstList = secondList; if (firstList.isEqual(secondList)) cout << "They are the same!" << endl; else cout << "The lists are different" << endl; cout << "The contents of the first list are: "; firstList.print(); cout << "The contents of the second list are: "; secondList.print(); cout << "Added 12 and Removed 3 from the second list." << endl; secondList.add(12); secondList.remove(3); if (firstList.isEqual(secondList)) cout << "They are the same!" << endl; else cout << "The lists are different" << endl; cout << "The contents of the first list are: "; firstList.print(); cout << "The contents of the second list are: "; secondList.print(); cout << "Added 4 to the first list." << endl; firstList.add(4); cout << "The size of the first list is: " << firstList.size() << endl; cout << "Cleared out the second list." << endl; secondList.clear(); cout << "The size of the second list is: " << secondList.size() << endl; cout << "The contents of the first list are: "; firstList.print(); cout << "The position of 10 in the first list is: " << firstList.search(10) << endl; cout << "The element at position 0 of the first list is: " << firstList.getElementAtPosition(0) << endl; cout << "I am printing out the contents of the first list from a 'for loop': " << endl; for (int i=0; i<firstList.size(); i++) cout << firstList.getElementAtPosition(i) << ' '; cout << endl; return 0; }