Write a function that takes in three parameters: The function should go through
ID: 3610157 • Letter: W
Question
Write a function that takes in three parameters:
The function should go through the array one element at a time,checking each element to see if it's the search key. The functionshould return the index where the search key islocated.
Keep in mind that the search key may not be found. Devise anelegant way to return this information.
Write a main program that tests your function with userinteraction. Ask the user to enter a value to look up, call yourfunction to do the search, and report the results back to the userin a user-friendly way. Input of the array is not a concern here,so I'll provide you code that hardcodes an array we can use fortesting:
Explanation / Answer
please rate - thanks #include using namespace std; int search(int[],int,int); int main() { int testarray[10]={12,2,33,0,7,66,7,123,92,89}; int found,num,max=10; coutnum; found=search(testarray,max,num); if(foundRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.