Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [100pts] Download hw.cpp. It is supposed to work as follows.
    1. It reads in ints from the user until a negative number is entered, storing them into a linked list.
    2. It will print out the contents of the list.
    3. Enter a loop that ends on "quit" but takes a couple commands:
      • "enter 7 after 9": You should insert the number (7) after the first occurrence of their target number (9).
      • "remove 12": You should remove the number (12) from the list.
      The program should print the current list from the front to the back, right after executing a command.

    Example runs:

    $ ./hw
    71 22 84 12 95 10 8 54 -1
    71 22 84 12 95 10 8 54
    > enter 23 after 12
    71 22 84 12 23 95 10 8 54
    > remove 84
    71 22 12 23 95 10 8 54
    > enter 40 after 22
    71 22 40 12 23 95 10 8 54
    > remove 71
    22 40 12 23 95 10 8 54
    > enter 77 after 95
    22 40 12 23 95 77 10 8 54
    > quit
    

    Your Task

    Tips

    Turn in