[SOLVED] CS150 Lab 25

35.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

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!****

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.