Question: Given an array, write a search algorithm in C++ that implements the following things: The array is given by a[5] ={1,1,2,2,10}. Asks the user to
Given an array, write a search algorithm in C++ that implements the following things:
The array is given by a[5] ={1,1,2,2,10}.
Asks the user to input a number called key.
If the key is in the array a, print out all the locations of the key
If the key is not found in the array, print out key isnt found.
Example: If the user inputs 2, the program should print out: key is at locations: 2 3. If the user inputs 5, the program should print out: key isnt found
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
