Little Array Lab

October/November 1997

In this lab, you will write a program that includes several functions with array input. Below is the text of a sample run that should resemble the results of running your program. The drawing on the next page is also part of the output. The requirements for your program follow the drawing.

Enter 10 integers:
0: 315
1: 67
2: 512
3: 256
4: 178
5: -30
6: 289
7: 472
8: 15
9: 99

Press Return To Continue

The array contains:
A[0] = 315
A[1] = 67
A[2] = 512
A[3] = 256
A[4] = 178
A[5] = -30
A[6] = 289
A[7] = 472
A[8] = 15
A[9] = 99

The minimum value is: -30

Enter desired minimum: 25
Enter desired maximum: 350
The clipped array values are:
The array contains:
A[0] = 315
A[1] = 67
A[2] = 350
A[3] = 256
A[4] = 178
A[5] = 25
A[6] = 289
A[7] = 350
A[8] = 25
A[9] = 99


Terminating Program
Press Return To Continue

  1. Write a function to input the array data.
    Write a function to write out the array data.
    Write a main program that calls your two functions.
    See the sample text output on the previous page.

  2. Add a function to find the minimum of the array values.

  3. Add a function that gets desired min and max values from the user and trims the array values as in tour sample run.

  4. Add a procedure that draws the trimmed array values in a bar graph.
    Note: If you enter desired min and max values between 0 and 400, the bars will fit in the window without scaling. That's sufficient for this lab.

Turn in: Printouts of the source code, text and drawing windows after a sample run.
Diskette with project, source code, and working application.


Last Updated: October 13, 1997 5:48 pm by
Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1100/PROG/LittleArrayLab.html