CS245 - CS II Spring 1997 LAB 8


Due by the end of lab(Mar. 25, 1997):

Write a program that

  1. reads in an array of numbers from the keyboard,
  2. asks the user to enter a number to find in the array,
  3. uses a find function (similar to the one below) to find the requested number in the array and return its positions or -1 if it is not in the array.
  4. let the user know the result of the search.




int Find(IntArray arr, int match, int end)
{
   for (int j = 0; j <= end; j++)
       if (arr[j] == match)
          return j;
   return -1;
}