1). Read in names to sort until the user types the \"enter\" key as the first ch
ID: 3619633 • Letter: 1
Question
1). Read in names to sort until the user types the "enter" key as the first character of a string (the maximum number of names is 20, there is not a maximum length to a name).2). After sorting and displaying the array of strings, ask the user for a string to search for (again, no maximum length).
3). Do a binary search to find if the strings is in the array.
4). If the string is in the array, tell the user the index of the string.
5). If the string is not in the array, tell the user that it is missing.
6). Repeat items 3 thru 5 until the user enters the "enter" key as the first character of the string, at which time the program will complete.
Explanation / Answer
#include #include #define DEBUG true using namespace std; int binarySearch(string name, string names[], int first, int last) { if (DEBUG) coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.