This tests the int instantiation:
{
int input1[10] = {1,2,3,4,5,11,7,8,9,10};
int input2[6] = {10,20,30,40,50,60};
int c1 = 11;
int c2 = 30;
int c3 = 17;
int c4 = 10;
int c5 = 3;
char *name[] = {"intQaitlin","intQuinn","intJim","intPauli"};
cout << "Instantiating List Qaitlin" << endl;
INT_DLLIST Qaitlin(name[0]);
cout << endl << "Building Qaitlin List" << endl;
Qaitlin.build_list(input1,size1);
cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
cout << endl;
cout << endl << "Qaitlin = " << endl << Qaitlin << endl;
cout << endl << "Delete the element " << c1 << endl;
Qaitlin.delete_element(c1);
cout << endl << "Qaitlin = " << endl << Qaitlin << endl;
cout << endl << "Insert element " << c2 << "after "
<< c5 << endl;
Qaitlin.insert_after(c5,c2);
cout << endl << "Qaitlin = " << Qaitlin;
cout << endl << "Insert element " << c4 << "before "
<< c3 << endl;
Qaitlin.insert_before(c3,c4);
cout << endl << "Qaitlin = " << Qaitlin;
cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
cout << endl << "Sort the list Qaitlin." << endl;
Qaitlin.mergesort();
cout << endl << Qaitlin << endl;
cout << "Copy Constructor Test: Copy Qaitlin into Quinn:" << endl;
INT_DLLIST Quinn = Qaitlin;
cout << "Quinn = " << Quinn;
cout << "Instantiating List Quinn" << endl;
INT_DLLIST Jim(name[2]);
cout << endl << "Building Jim List" << endl;
Jim.build_list(input2,size2);
cout << "Jim has " << Jim.get_number_elements() << " elements";
cout << endl;
cout << endl << "Jim = " << endl << Quinn << endl;
cout << endl << "Overloaded Equal Test: Jim = Qaitlin" << endl;
Jim = Qaitlin;
cout << endl << "Jim = " << endl << Quinn << endl;
cout << "Test Overloaded Input Operator: " << endl;
INT_DLLIST Pauli(name[3]);
cin >> Pauli;
cout << "Pauli = " << Pauli;
return 0;
}
The corresponding output is:
Instantiating List Qaitlin Building Qaitlin List Qaitlin has 10 elements Qaitlin = 1<-->2<-->3<-->4<-->5<-->11<-->7<-->8<-->9<-->10. Delete the element 11 Qaitlin = 1<-->2<-->3<-->4<-->5<-->7<-->8<-->9<-->10. Insert element 30after 3 Qaitlin = 1<-->2<-->3<-->30<-->4<-->5<-->7<-->8<-->9<-->10. Insert element 10before 17 The element 17 is not in the list. 17 is not in the list, so do not insert. Qaitlin = 1<-->2<-->3<-->30<-->4<-->5<-->7<-->8<-->9<-->10. Qaitlin has 10 elements Sort the list Qaitlin. 1<-->2<-->3<-->4<-->5<-->7<-->8<-->9<-->10<-->30. Copy Constructor Test: Copy Qaitlin into Quinn: Quinn = 1<-->2<-->3<-->4<-->5<-->7<-->8<-->9<-->10<-->30. Instantiating List Quinn Building Jim List Jim has 6 elements Jim = 1<-->2<-->3<-->4<-->5<-->7<-->8<-->9<-->10<-->30. Overloaded Equal Test: Jim = Qaitlin Jim = 1<-->2<-->3<-->4<-->5<-->7<-->8<-->9<-->10<-->30. Test Overloaded Input Operator: Please Enter the element which terminates input: 999 12 35 -76 89 999 Pauli = 12<-->35<-->-76<-->89.