Classwork 21: Putting it Together
Objectives
To practice compiling a program from pieces written by different people.
Assignment
For Classwork 20, students in this class wrote different portions of a program to print out an annual calendar. For this classwork, you have to assemble the pieces to create a working program.
When students finish a function for the program, their files will be copied to this directory:
http://userpages.umbc.edu/~chang/cw21/
Create a directory where you can download files. You do not want this to be the same directory as the one you used for your own programs. Use the mkdir command in Unix to create a directory:
At first, you should download these 3 files: calendar.h, calendar.c and stubs.c. Then, verify that these files can be compiled and that you can run the resulting program. (It will not print out a correct calendar, yet.)
Note that some debugging statements have been added to calendar.c to help us check whether various functions are working properly.
When another part of the program becomes available, you can download the file and test it. To do so, edit the stubs.c file and comment out the corresponding function in stubs.c. Then, compile the new file with the rest of the program.
For example, if GetYear.c becomes available, then you should surround the GetYear() function in stubs.c with /* and */. This comments out the GetYear() function in stubs.c and prevents it from being compiled a second time. If we do not comment out GetYear(), the compiler will complain that there are two functions called GetYear() and that it doesn't know which one to use.
Now you can compile:
Repeat these steps until you get a working calendar program.
Submitting
When you have assembled a working program or when class is almost over, use the script to record yourself compiling and running the calendar program. Then submit the typescript file to cw21: