#include using namespace std; int main() { // Declare and initialize the sorted array int arr[] = {1, 3, 5, 7, 9, 11}; int n = sizeof(arr) / sizeof(arr[0]); // Calculate the size of the array // Declare and initialize the number to search for int num = 9; // Use a binary search approach to search for the number in the array bool found = false; int left = 0, right = n - 1; while (left <= right && !found) { int mid = left + (right - left) / 2; // Calculate the middle index if (arr[mid] == num) { found = true; cout << "Number " << num << " found at index " << mid << endl; } else if (arr[mid] < num) { left = mid + 1; // Search in the right half of the array } else { right = mid - 1; // Search in the left half of the array } } // If the number was not found, print a message if (!found) { cout << "Number " << num << " not found in the array" << endl; } return 0; }