Project 2 - Numbers

Due: Wednesday, April 19 BEFORE CLASS


Congratulations! You are the new Teaching Assistant for CMSC 104, Section 0102! As part of your job, you are to write a program to analyze the midterm exam scores for the class. Your program should compute

A data file containing the scores for you to use as input to your program will be provided. (NOTE: These are NOT the real scores from your midterm exams!) The scores are between 0 and 100, inclusive, and are in random order. The last value in the file is -1. This is the sentinel value that signals the program to stop reading scores.

To use the data file as input to your program, you will use UNIX redirection. By using redirection, you can have UNIX fill the stdin buffer from a data file rather than from the keyboard. The scanf statement that you use in your program will look exactly the same as it would if you were getting your input from the keyboard. Since you will be getting the values from a file instead of from a user typing at the keyboard, you will not need to prompt the user.

When you run your program, use the following command:

a.out < proj2.dat This is how UNIX redirection is done. It is saying to run your executable file, using the file proj2.dat as input. The file, proj2.dat, can be seen by following this link. Within your gl account, bring up Netscape and go to this link. Then under the File menu, choose the Save As option. This will save a copy of the proj2.dat file into your directory so that you can use it as input. This is most easily accomplished if you use the SGI machines in ECS 005 rather than either the IBMs or Macs. DO NOT just cut and paste to capture the text and put it into a file because you may capture some unwanted extra spaces.

Here is an example of what the data file might look like:

79 50 82 0 90 85 -1 Here is the output that would result from using this sample data file:
CMSC 104, Section 0102, Midterm Exam Analysis 6 midterm exams were taken. The highest score was 90 percent. The lowest score was 0 percent. The average score was 64.3 percent. The number of A's was 1.

Your program's output should follow this EXACT format.


Make sure that you follow the "C Coding Standards" and "Indentation Styles" given on the Projects web page. Your program will be graded not only on whether or not it produces the correct results, but also on whether or not you follow these standards and styles.


Last Modified: Thursday, 06-Apr-2000 22:15:22 EDT

Thursday, 06-Apr-2000 22:15:22 EDT