//-------------------------------------------------------------------- // // Laboratory 7 show7.cpp // // Linked list implementation of the showStructure operation for // the List ADT // //-------------------------------------------------------------------- template < class DT > void List
:: showStructure () const // Outputs the items in a list. If the list is empty, outputs // "Empty list". This operation is intended for testing and // debugging purposes only. { ListNode
*p; // Iterates through the list if ( head == 0 ) cout << "Empty list" << endl; else { for ( p = head ; p != 0 ; p = p->next ) if ( p == cursor ) cout << "[" << p->dataItem << "] "; else cout << p->dataItem << " "; cout << endl; } }