Lab 14

Don't forget to finish the quiz first.  There is a time limit of 5 minutes to complete the quiz from when you open it.

Lab assignment: Introduction to linked list

Building off of the code presented in class, we'll be using the Node struct and Node*s (Node stars, or node pointers) to build and operate on a linked list.  Starting from the code we give you, add functionality to the source file where the comments request it to make this list more functional.

 For a lab score of 1: Add a menu option to find sum of only odd numbers in the list, write a function which does so, and add the appropriate call in main.  You should use the existing processNumbers function as a base, as it already sums all of the numbers of the list.

 For a lab score of 2: Implement the code in place inside the switch statement currently commented as such to both print and remove the first element (the head) of the list.  You may do these in either order, and need not worry about actually recovering the memory of the deleted element (though you should learn to do so properly for later on).  Be careful not to delete the whole list.

 For a lab score of 3: Same as #2, except now write this in a function.  Since the list is defined locally, you must pass it in some way to a function.  There are many ways to accomplish this task and it is interesting to consider the many alternatives.  Give this function it's own place in the switch statement, since I still want to see your code for the second point.

Don't worry about comments, coding conventions, or error checking of the input for this submission, though if you have free time it does make the code nicer.

Do put the names and netIDs of both partners in a comment at the top, as well as the lab section you are in.  You guys have really been slacking on this, and it's hard to tell whether you were working alone or just forgot to include the authors.

Be sure to take turns coding!  It's easy to get wrapped up in the coding and forget to give your partner their turn on the keyboard, and it's too easy to sit back and discuss the problem without writing the code yourself.

Submission:

1. You should work with a partner for this lab, though as usual you may work alone.  Only one of you needs to submit the program to Blackboard.  All author names must be present in the program you submit.

2. You have until noon on 4/19 (tomorrow) to submit the lab to Blackboard.  Plan your time wisely, and ask questions if you are working but can not progress.

3. You may use either C or C++ to complete this assignment, but be sure you use the appropriate extension for your submission.  Also, executables will not be accepted, so please do not submit any a.outs or their like.