Question: Need help with the following. Thanks:) Second image is the main.cpp that needs to be edited # Problem Complete the LinearSearch function so that it

Need help with the following. Thanks:) Second image is the main.cpp that needs to be edited

Need help with the following. Thanks:) Second image is the main.cpp that

needs to be edited # Problem Complete the LinearSearch function so that

# Problem Complete the LinearSearch function so that it returns the index at which the number was found in the array or -1 otherwise. # Sample Inputs and Outputs NUMBERS: 2 4 7 10 11 32 45 87 Enter a value: 11 Found 11 at index 4. NUMBERS: 2 4 7 10 11 32 45 87 Enter a value: 100 100 was not found. #include using namespace std; int LinearSearch(int numbers[], int numbersSize, int key) { /* Your solution here */ return -1; /* not found */ } int main() { int numbers [] { 2, 4, 7, 10, 11, 32, 45, 87 }; const int NUMBERS_SIZE = 8; int i; int key; int keyIndex; cout > key; keyIndex = LinearSearch(numbers, NUMBERS_SIZE, key); if (keyIndex -1) { cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!