Starting from:

$29.99

CS150 Lab 25 Solution

Create an array of 10 integers containing the following values (in this order): 12, -7, 3, 17, 42, 6, 18, -15, 0, 1. Create a function called seqSearch that takes a const array and an integer key as parameters, and returns the array slot number that the key was found in. If the key was not found, the function should return -1. Main should use the function to have the user enter a number and print the array slot it was found in, or that it was not found.
Test Cases:
Test Case 1:
Enter a number to search for: <17> 17 was found in array slot 3.
Test Case 2:
Enter a number to search for: <12> 12 was found in array slot 0.
Test Case 3:
Enter a number to search for: <1> 1 was found in array slot 9.
Test Case 4:
Enter a number to search for: <40>
40 was not found.
****Note: Should NOT say 40 was found in array slot -1!****

More products