Question: Linear search Write a program that performs a linear search on an array of numbers. Create an array of 20 int values Fill the array
Linear search
Write a program that performs a linear search on an array of numbers.
Create an array of 20 int values
Fill the array with random numbers between 1 to 20.
Create a function which takes three parameters:
1.the array of random numbers
2.the size of the array
3.a target number to search for
The function performs a linear search of the array and returns the number of times the target number appears in the array
Create a loop which:
1.prompts the user for a target number from 1 to 20:
2.invokes the function described above and tells the user the number of times the target number appears in the array
3.exits the loop when the user enters 0.
Once the loop is done, print. a summary report showing a count each number actually appears in the array. Use the function created above determine the counts.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
