Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

Develop successful mentoring programs. page 400

Answered: 1 week ago