// listwindow.C // Burt Rosenberg // Oct 1997 // Part of the implementation of a list with a window. // Unimplemented methods to be implemented by student. #include struct ListNode { char item ; ListNode * next ; ListNode(char i, ListNode * n) // CONSTRUCTOR { this->item = i ; this->next = n ; } void print(void) // DATA DISPLAY { cout << item << " \n" ; } } ; class ListWithWindow { private: ListNode * root ; ListNode * window ; public: ListWithWindow(void) ; void insert(char item) ; void print(void) ; void next(void) ; void setWindow(int location) ; char getAtWindow(void) ; } ; ListWithWindow::ListWithWindow(void) { window = root = NULL ; } void ListWithWindow::insert(char item) { root = new ListNode(item, root) ; } void ListWithWindow::print() { for ( ListNode * ln = root ; ln!=NULL; ln=ln->next ) ln->print() ; } void main() { ListWithWindow * lww = new ListWithWindow ; lww->insert('a') ; lww->insert('b') ; lww->insert('c') ; lww->print() ; }