CPTR-142 Homework #9 - Due Wednesday 4/30/14
In class we outlined example code for creating a linked list using
dynamic memory allocation. I have cleaned it up some by using
more standard names (for example not using underlines in names),
fixing some minor syntax issues, and implementing the functions (methods)
for adding nodes and printing a list of grades. Study this example
code with the goal of understanding it. You will note that in the
declaration of the node data type that node is used recursively. That
is ok in this context.
Recall that this
class is designed to save and manipulate student scores (integer
values 0 to 100, i.e. percent). For homework 9 add these functions
to those already in the example:
- Calculate the average and return it to the caller
- Find the max value and return it to the caller
Call these functions in the main and print out the result.
If you wish to write other functions as well that is ok.
Have some fun!
Bring a printout of your main.cpp
file to class. Email the main.cpp files to
me but as you do that change the name to: name_program9.cpp
where name represents your last name. And between name and
program9 is an underscore. I appreciate not having spaces
in your file names.
Larry Aamodt PhD, PE
Professor of Engineering and Computer Science
Walla Walla University
Contact:
via email: AamoLa (at) wallawalla.edu
via phone: x2058