CS 1620 Assignment #8 Spring 2001

The Last One

How to handin.
Due : Monday Apr 9, 2001 @ midnight
No assignments will be accepted after Apr 11, 2001 @ midnight.
  1. Given two integer arrays a and b, say with 12 elements each. Write a program that performs the following:
    1. Input some data from the user into the two arrays.
    2. Output the sum of the elements in each of the two arrays.
    3. Output the sum of the products of corresponding elements. a[0]*b[0]+a[1]*b[1]+ ...
    4. Add the contents of both arrays. The result should be stored in a third array, say c. That is, c[0]=a[0]+b[0], c[1]=a[1]+b[1], ... All the three arrays must be passed as arguments to a function called addArrays.
    5. Add another function called maxMinEven to search through the array c to find the smallest and largest numbers. Also maxMinEven counts the number of even numbers.
    6. Searches the first n elements of an array for an element with a given value. If the value is found then the function should return true and also return the index of the element in the array. If not found then the function should return false.
    7. Now sort the array c using the bubble sort algorithm. More specifically, write a function called bubbleSort that accepts three arguments - the array c, a count of the number of elements in the array and a boolean variableorder indicating whether the array should be sorted in increasing or decreasing order. The user should be able to sort in increasing or decreasing order.

!! Note: Your grade will be awarded for program correctness, readability, and documentation .
Assignment List | Prev | Computer Science 1620
Department of Mathematics & Computer Science
University of Lethbridge Home Page