Premium Essay

Progamming 2 Proj

In:

Submitted By kaheem96
Words 535
Pages 3
University of Technology, Jamaica
Faculty of Computing and Engineering
School of Computing and Information Technology
Programming II (CMP1025)
Lab Exercise Five
1) Write a main module and in it declare and fully initialize a local array of 15 integer numbers, a local array of 20 characters (not a string), and a local array of 10 floating point numbers. Use different values to initialize each array (don't use 0, blank space, or repeat any value). Also, ensure that the values in each of the three arrays are in sorted order (sorted in ascending order).
2) Write a module called Display that takes an array of integer values and the size of the array as arguments, and then outputs the contents of the array on the screen in a neat format. Each value in the array must be separated by a single space. E.g. 10 20 30...
3) In your main module, call the Display function and use it to show the contents of the 15-value integer array you declared and initialized earlier.
4) Write a module called AVERAGE that takes an array of integer values and the size of the array as arguments, then calculates and returns the average of those values. Feel free to use recursion or iteration in your answer. Also remember to declare your function prototypes.
5) In your main module, call the AVERAGE function and use it to calculate the average of the 15-value integer array you declared and initialized earlier, then display the result. The result returned from the function is to be displayed in the main module, not in the function.
6) Implement the linear search (also called the sequential search) algorithm from the pseudocode given in the arrays lecture.
7) Demonstrate how the sequential search algorithm can be used in your main module. You should allow the user to enter an integer value to be found (the search key) in the main module. If the search key is found, display where

Similar Documents