#include "simple_ll.h" using namespace std; ListNode::ListNode(const int &element, ListNode* nextPtr) { num = element; next = nextPtr; } List::List() { first = 0; } void List::add(int myNum) { ListNode* l; l = new ListNode(myNum, first); first = l; } void List::showList() { ListNode* l; l = first; cout << endl << "Here is the list: "; while (l != 0) { cout << l->num << " "; l = l->next; } cout << endl << endl; } void List::showListAddresses() { ListNode* l; l = first; cout << endl << "Here are the list addresses: "; while (l != 0) { cout << endl << "l is pointing to " << l << endl << " That node's num field has contents of" << setw(8) << l->num; cout << endl << " Its next field has contents of " << l->next << endl; l = l->next; } cout << endl; }