CS201
Lab 6 - Multiple File Compilation


Objectives:


Readings:


Deliverables: (DUE AT THE END OF YOUR NEXT LAB!)


TO DO (for today's lab)


Helpful Hints


Declaring prototypes in a header file

I like to put all my prototypes in a separate file (here, I called it proto.h) and then to include this file in my main program (#include “./proto.h”). When you do it this way, you may need some additional pre-processor directives to avoid duplications of your declarations (just to play it safe...). This time, file proto.h should include prototypes of all functions mentioned in your textbook (p. 322). Here is a sample proto.h file (I included pre-processor directives to avoid accidental duplications of my functions' prototypes):


Linking the source files

OK, so here is an example of what you want to do (using your Makefile):

And here is how you can get there:

References to proto.h in the Makefile can be omitted, if you included it as I mentioned above. Repetitions do not bother us, since we used Conditional Compilation in our header file. 


Testing the program

You can test your program by controlling it from your screen and keyboard. For a test run of only problem 4 you can enter the followings after respective prompts:
4
1000
25
5
The above data should produce the following results.
The rate in milliliters per hour is 40.

You can also write test files (with job selections and relevant data entries) and use input redirection. For instance if you enter to test numbers to your test file as presented on the left-hand side of the figure below, you can simulate some cases, as presented on the right-hand side of the figure.


Formatting the output 

There will be quite a few prompts coming out of your program. You will need to have them formatted exactly as shown in the textbook. Here are some results I got, maybe you will find it useful when programming:


Grading Scheme

Program compile and execute 20%
Program meets all specifications 60% (e.g. makefile, pass by value/reference, menu etc. Also ask your TA specifically about what preciously he is looking for)
Program follow code conventions and contain proper documentation. 20%