02/21/00
COM1100 Winter2000 Yuhong Yin
11
Binary search algorithm – con’d
n
// function call
n
int list[] = {12, 23, 32, 45, 57, 68};
n
int key;
n
cout << "Enter the item you are searching for: ";
n
cin >> key;
n
n
cout << "The location is :" << binarySearch(list, 6, key)
<< endl;
n