Computer Science 2010 Linked List Exercises
Complete the following exercises. The solutions should be written on paper and
submitted in class on Monday, February 25. These exercises are similar to test
problems so you should study them carefully.
- Declare all necessary data types to define a node for a linked list that
contains the following information at each node.
Estimated
Cost--double
Actual
Cost--double
Approval
Code--char
-
h points to the beginning of a linked list of double values. Declare the necessary variables to represent a node on this list. Also write the C++ code to print
the elements on the list one per line properly formatted.
-
h
points to the beginning of a linked list of double values. Write the C++ code to print all
values on the list that are less than 10. Print the values one per line.
- h
points to the beginning of a linked list of double values. Write the C++ code to
print the first value on the list that is greater than 100. Print an
appropriate message if there is no such value.
- h points to the beginning of a linked list of double values. Write the C++ code to
insert an element with value zero just prior to the first value that is
negative. Print an appropriate message if there is no negative value.
Do not use any previously written procedures.