Lecture 14:  Arrays

Activity:



We saw in today's lecture the use of a new concept called arrays.  You will get a chance to practice using arrays in this programming exercise.  Your instructor likes to see visually how his/her students perform on exams and homework.  He or she has asked you to write a program that does the following:
1.  Asks the user to enter the grades one at a time.  When the user has no more grades to report, he or she enters -1.
2.  Prints a histogram like the following:
90 - 100: XX
80 - 89: XXXX
70 - 79:
60 - 69:
50 - 59: X
40 - 49: X
30 - 39: XX
20 - 29:
10 - 19: X
00 - 09:

Notice that this histogram states that two scores are between 90 and 100, 4 scores are between 80 and 89, 1 score is between 50 and 59, 1 score is between 40 and 49, 2 scores are between 30 and 39, and 1 score is between 10 and 19.

Be sure that when planning your solution, you make use of an array and multiple functions.

Just like the other exercises, it is important to proceed with the following steps:  program specification, the algorithm and basic design of the program, and then the implementation of the C code.  When you have finished the coding portion, be sure to test your program on some sample input.

Problem Specification:
 
 
 
 
 

The Algorithm:
 
 
 
 
 
 
 

The C Program: