Third Array Worksheet

1. Write a function match which takes 2 integer arrays (named one and
    two) and returns the number of times "matches" occur in parallel
    positions in the two arrays. That is, count the number of times
    one[i] == two[i]. The lengths of both arrays are the same.


2.  Write the statements to declare two arrays of size 25, read values
    into the arrays, from the keyboard (fisrt one array, then the other),
    call your match function, and print out the number of matches in the
    two arrays.


3.  Write a function named count that will count and return the occurrences
    of a given character in an array named letters.  The parameters will
    be the array letters, the number of elements stored in the array, and the
    character to count. For example:  If the array contained the values
             x 8 R A a a 0 s S a A
    and the character to count was 'a', then the function would return 3.


4.  Write the statements to declare an array of characters, and initialize
    the array to contain the characters: f A i @ N Z a 7 p Y h A. Call
    the count function and print the number of times the character p is
    contained in the array.


5.  Write a function called search that receives an array of ints, the
    number of elements stored in the array, and a number to search for.
    The function will return true if the number is contained in the array,
    and will return false otherwise.


6.  Write the statements to call your function to search for the value
    1500 in an array called salaries which has 100 elements. Print a
    message telling whether the value was found in the array.

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2013