Code Maintenance
One of the skills that is most useful as a programmer, especially with
the burgeoning popularity of the Open Source movement, is to be able
to understand and work with other people's code. If all programmers
had style comparable to much of what we have seen from the students in
this course so far, this would be a fairly easy task. However,
entirely too many people take little pride in their work and produce
code that is illegible at best and just plain malicious at worst.
In this lab, your task is to take a piece of maliciously bad code and
make it useful. To get full credit, you must do the following:
- Format the code so that it would get at least a 95% according to
our
course style guidelines
- Identify what the program is supposed to be doing (there
really is only one sane answer for this)
- Fix the logic error
- Fix the run-time error
- Ensure that the program compiles with -W -Wall -Werror -pedantic
The code for this assignment can be found here.
Bonus
.4 points Find a partner that is also done with the assignment.
Email your program to them. Each of you should comment on the style
of your partner's work.
.2 points What does #define do?
.2 points What is this algorithm called?
.2 points Find a Linux command line utility that does the same
thing as this program, only better. What is that command called?
.2 points Take one of your previous lab assignments, and format
it as poorly as possible. (Sometimes it is good to practice what
not to do. This is actually good practice in understanding the
subtleties of C++.)