I'm working on a problem here.It says to write a program that creates an array of 100 random integers in the range of 1 to 200 and then using the sequential search,searches the array 100 times using randomly generated targets in d same range and then to display the number of searches completed, the number of successful searches, the percentage of successful searches, the average number of tests per search.
I have started working on this but i am stuck with the sequential search part.I have written the code that shows the 100 random integers in the range of 1 to 200 but using the sequential search to search the array 100times is giving me problems.Here is the code:
I'm not sure what you are saying the problem is, but to me it sounded like a success is finding at least one copy of the number in the array, but yours would count each copy as a success. If that's not what you want (It may be, I'm not sure), you can add a break the after ++successes to stop it from looking further in the array.