out: Monday, February 8, 2021
due: Friday February 12, 2021 by 10:00 am
Do a git pull
and find directory ex07/
.
This exercise will probably involve much more time reading code than writing it. What the code does is not described in detail here. That's intentional. (The code is so beautiful it describes itself!)
You cannot delete anything already in any of the source files. You may only add characters to the files.
It is intended that the code build with the command g++ -std=c++17 -g -Wall List333.cc ex07.cc
.
It doesn't. Fix the problem(s) that prevent it from building. When you've done that, the build command
will produce an executable. It doesn't matter if the executable runs without error. The goal of Part A
is just to correct the compile time error(s). (Remember that you may only add to the files.)
Once the code builds, you should see something like this as output:
One: -0.221 0.572 -1.570 0.444 0.158 -0.018 0.441 0.240 1.077 Non-Negative List: 0.221 0.572 1.570 0.444 0.158 0.018 0.441 0.240 1.077 Updated One: 1.570 0.444 0.158 0.018 0.441 0.240 1.077
The code doesn't do anything useful - it is a completely artificial example for the purposes of this exercise. What it does is to create a kind of linked list. One of the list constructors will generate a list at random. Each element of the list holds a pointer to a double. The double is initialized randomly.
If you run valgrind
on the executable you'll see it has a bit of a memory leak problem. Eliminate
the leak(s). (Remember that you cannot remove anything from the files, just augment what is already there.)
You should tag your files ex07-final
and push to your repository.