Please help with C++ :
Template a binary search function. Prove that it works with at least 2 types of data.
Example Output:
Integer test array contains:
0 1 1 2 3 5 6 13 21 32 55
-1 is not in the array.
0 is at index 0
1 is at index 2
2 is at index 3
3 is at index 4
4 is not in the array.
5 is at index 5
6 is at index 6
7 is not in the array.
String test array contains:
head knees shoulders toes
elbows is not in the array.
knees is at index 1
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |