# Question: write a program that has at least 20 integers stored...

###### Question details

Write a program that has at least 20 integers stored in an array in ascending order. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should also keep count of the number of comparisons it makes. Display these two counts on the screen.

This is the middle of the code. There are at least 10 lines above this portion and 13 lines below it.

// Compare searches for a value in the middle of the array

cout << "Searching for a value in the
middle of the array -- \n";

cout << "Searching for the value
296.\n";

numCompares = linearSearchBench(tests, SIZE,
296);

cout << "The linear search made " <<
numCompares

<< "
comparisons.\n";

numCompares = binarySearchBench(tests, SIZE,
296);

cout << "The binary search made " <<
numCompares

<< "
comparisons.\n";

// Compare searches for a value at the end of
the array

cout << "\nSearching for a value at the
end of the array -- \n";

cout << "Searching for the value
600.\n";

numCompares = linearSearchBench(tests, SIZE,
600);

cout << "The linear search made " <<
numCompares

<< "
comparisons.\n";

numCompares = binarySearchBench(tests, SIZE,
600);

cout << "The binary search made " <<
numCompares

<< "
comparisons.\n";

// Compare searches for a value not in the
array

cout << "\nSearching for a value not in
the array -- \n";

cout << "Searching for the value
312.\n";

numCompares = linearSearchBench(tests, SIZE,
312);

cout << "The linear search made " <<
numCompares

<< "
comparisons.\n";

numCompares = binarySearchBench(tests, SIZE,
312);

cout << "The binary search made " <<
numCompares

<< "
comparisons.\n";

return 0;

}