//This program uses thebinarySearchfunction to search for a name in the array. This//program assumes thebinarySearchfunction has already been defined.
Module main()
Constant Integer SIZE = 5
Declare Sting names[SIZE] = "Zack, "James", "Pam", "Marc", "Susan"
Declare StringsearchName
Declare Integer index
Display "Enter a name to search for."
InputsearchName
Set index =binarySearch(names,searchName, SIZE)
If index != - 1 Then
DisplaysearchName, " was found."
Else
DisplaysearchName, " was NOT found."
End If
End Module
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here