Array

You will write a program which searches an array of integers to find a given integer. The program should print out the array index where the given integer is found, or it should print -1 to indicate that the integer was not found in the array. Array indices begin at 0. Your program will accept two arguments at the command line, 1) the name of the array filewhich contains the array, and 2) the integer to search for in the array. Give your executable the name MySearch. The following is an example of how your code will work when it is called with an array file called arr_file.txt which contains the following array, 5 6 7 8 9. In this example, we assume that the linux prompt is the symbol ‘$’.

 

$ MySearch arr_file.txt 6

1

 

$ MySearch arr_file.txt 8

3

 

$ MySearch arr_file.txt 2

-1

 

Multiple Processes

 

The unique aspect of this search is that it will use multiple processes to search different p

Leave a Reply

Your email address will not be published. Required fields are marked *