// File: main1.C // // Testing the GenList and IntCell classes #include #include #include #include "intcell.h" main() { GenList L ; int length ; IntCell *iptr ; ListCell *ptr ; L.append(IntCell(5)) ; L.append(IntCell(5)) ; L.append(IntCell(2)) ; L.append(IntCell(7)) ; L.append(IntCell(5)) ; L.append(IntCell(5)) ; L.append(IntCell(13)) ; L.append(IntCell(12)) ; L.append(IntCell(11)) ; L.print() ; cout << endl ; length = L.length() ; cout << "length = " << length << endl ; cout << endl ; IntCell x(5) ; L.remove(x) ; L.print() ; cout << "\n" << endl ; L.append(IntCell(17)) ; L.append(IntCell(21)) ; L.print() ; cout << "\n" << endl ; ptr = L.chop() ; cout << "Removed item: " ; ptr->print() ; cout << endl ; L.print() ; cout << "\n" << endl ; delete ptr ; iptr = (IntCell *) L.begin() ; cout << "First item: " << iptr->data << endl ; L.print() ; cout << "\n" << endl ; delete L.chop() ; delete L.chop() ; delete L.chop() ; delete L.chop() ; delete L.chop() ; L.print() ; cout << endl ; delete L.chop() ; L.print() ; cout << endl ; L.append(IntCell(1)) ; L.append(IntCell(2)) ; L.append(IntCell(3)) ; L.print() ; cout << "\n" << endl ; IntCell c(1), d(2) ; ListCell z ; cout << "c.id = " << c.id() << endl ; cout << "d.id = " << d.id() << endl ; cout << "z.id = " << z.id() << endl ; }