Project 1: A Linked List Implementation in C
Due Date
Project 1 is due at midnight Friday, February 11, 2000. Note that
this means before 23:59:59 on Friday evening.
Project 1 has been extended
Objectives
The objectives of this project are to:
- Review C language syntax
- Exercise your abilities to analyze and modify an existing program
- Review the concepts of dynamic memory allocation and linked lists
- Use a makefile
- Assess your readiness for success in CMSC 202
Background
For this project, you will be completing an existing C program. The
program uses a linear linked list structure to keep track of an inventory
of compact discs (CDs). This is the only project for which you will be
using C; all others will be written in C++. However, use the C++
compiler, not the C compiler.
As you work with the source files used in this project, you should also get a good idea as to whether or not you have the proper background in C programming to
succeed in this course.
Tasks
- Study the source code that you have been given as a starting point. Notice
that some of the functions are incomplete and must be finished by you.
Here are links to the source code:
- Use a makefile that will build an
executable from the source files. Project1 should be the name of the
executable file and your program should compile just by typing
make
.
The starter source files will compile with four warnings
indicating that four non-void functions require return values. Here is
an example of one of the warnings:
CC -c Date.c
"Date.c", line 7: warning(1116): non-void function "dateCompare" (declared at
line 3) should return a value
}
^
These warnings will go away after you write the code for the bodies of the functions.
- In the .h files, add
comments before each function prototype. Some of these are done for
you. Note that this project, although neatly organized, does not
strictly follow the rules that you will be
required to following in future projects.
- Finish writing the functions that are incomplete. Think first,
code later!
- You may not change any of the other code in the final version
of your project. This means you may change whatever you like to test
your program while you're working on it, but you should not
submit files with any other changes in the code.
- Test, test, test! This means you will need to
make temporary changes to main(), but keep in mind that when you turn
in your project, you should use the main() EXACTLY as it appears in
the original Project1.c file.
- For this project, you should submit a makefile and seven source
files named as follows:
- Project1.c
- Date.c
- Cd.c
- Inventory.c
- Date.h
- Cd.c
- Inventory.c
Coding Standards
For this project you are not required to follow the class
Coding Standards.
Your code should be clean and it should flow with the style of the surrounding
code.
Testing Your Program
Remember, your program must compile and run using the CC
compiler on the IRIX machines (umbc8/9). If your program does not compile
or does not generate the correct output, you will not receive full credit
for this project.
You should make sure that you have a makefile named either makefile
or Makefile
and that when you type make
your
program compiles to an executable called Project1
. Failure to
follow these simple directions will result in a reduced grade.
Sample Test Data
In addition to testing your program by entering data from the keyboard,
you can "automate" the testing process by running your program and
redirecting input from a file. Edit a simple text file, where each
line contains the data that would be entered by the user. If the
file is called input.dat, you would run your program
with the following command line:
Project1 < input.dat
Here is:
- A sample input file
- The output obtained from sample input file
You can use the sample input file for testing purposes, but keep in
mind that your program will be tested with DIFFERENT input data when
it is graded.
Submitting your Project
When you have finished and tested your project you can submit it electronically
using submit
. The project name for this assignment is
proj1
. As an example, to submit your Makefile
, you
would type:
submit cs202 proj1 Makefile
More complete documentation for submit
and related commands
can be found here.
Last Modified: February 5, 2000