Question: #include using namespace std; class ArrayManipulator{ // Creating array as the member of the class public: //const int max = 10; float array[10]; int binarysearchElements[8]

#include

using namespace std; class ArrayManipulator{ // Creating array as the member of the class public: //const int max = 10; float array[10]; int binarysearchElements[8] = {25,45,78,56,84,59,21,37}; void createArray(){ for(int i=0;i<10;i++){ cout<<"Enter the "<>array[i]; } } //Create a method that will generate 1000 random floats (between 1-100) No decimal valuables void GenerateRandomFloat(){ float randomArray[1000]; cout<<"The Generated array is: "<

//Create 1 method to output the average of all numbers input by the user. void averageArray(){ float sum = SumArray(); cout<<"The average of all elements in list is: "<

//Create 1 method to output all the numbers input by the user. void showallElements(){ cout<<"The elements entered by user is : "<= l) { int mid = l + (r - l)/2; // If the element is present at the middle // itself if (arr[mid] == x) return mid; // If element is smaller than mid, then // it can only be present in left subarray if (arr[mid] > x) return binarySearch(arr, l, mid-1, x); // Else the element can only be present // in right subarray return binarySearch(arr, mid+1, r, x); } // We reach here when element is not // present in array return -1; } }; int main() { int searchNumber; ArrayManipulator arraymanipulator; //cout<<"Please enter the length of array : "; //cin>>arraymanipulator.max; cout<<"Enter the elements of array : "<> searchNumber; int result = arraymanipulator.binarySearch(arraymanipulator.binarysearchElements, 0, 7, searchNumber); (result == -1)? cout<<"Element is not present in array" : cout<<"Element is present at index "<< result + 1; return 0; }

Need help!! I keep getting the error as follows

warning: in-class initialization of non-static data

Error: member is a C++11 extension [-Wc++11-extensions]. Please suggest a fix for this code. It should be compatible with Xcode. Please help. Thanks in advance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!