13 Node * current = head;
14 while (current != NULL)
17 cout << current->
info <<
" -> ";
18 current = current->
next;
45 if (head == NULL || head->
info >= num )
49 Node * current = head;
51 while (current->
next != NULL)
56 current = current->
next;
64 Node * current = head;
66 while (current != NULL)
68 if (current->
info == num)
71 current = current->
next;
99 cout << endl <<
"enter option (1: insert; 2: delete; 3: reverse; 4: get; 0: quit) ";
108 if (after_this == NULL)
118 cout << endl <<
"number to insert: ";
127 cout << endl <<
"number to delete: ";
134 cout <<
"item not found!" << endl;
149 cout <<
"deleting list... " << endl;
150 while ( head != NULL )
162 while ( curr != NULL )
177 Node * current = head;
179 while (current != NULL) {
183 current = current->
next;
191 cout << endl <<
"enter 0-based position for an item: ";
196 cout <<
"Item at position " << k <<
" is " << p->
info << endl;
198 cout <<
"Item does not exist." << endl;
205 Node * head = NULL, * after_this;
209 cout <<
"input integers (-999 to end): ";
211 while ( num != -999 )
void insert_sorted(Node *&head, int num)
void delete_list(Node *&head)
void option_insert(Node *&head)
Node * find_prev(Node *head, int num)
void delete_head(Node *&head)
void head_insert(Node *&head, int num)
void delete_node(Node *after)
Node * get_item(Node *head, int k)
void option_get(Node *head)
void insert(Node *after, int num)
void option_delete(Node *&head)
void reverse(Node *&head)
void print_list(Node *head)
Node * find(Node *head, int num)