Question: C++ Write a function that will take a pointer to a vector of double pointers and a double value, a total of 2 parameters. The

C++

Write a function that will take a pointer to a vector of double pointers and a double value, a total of 2 parameters. The function must return the index of the vector as an int whose element points to a value more than the second parameter. If no elements point to a value greater than the second parameter or the first parameter is nullptr, return any negative number. Name the function findMore. See the template for clues.

CODE

#include #include #include

using namespace std;

void populateD(vector*);

//Change Nothing above this line

//TODO: Write your findMore function here

int main() { /*** *** Uncomment this section if you wish to test *** //Declare a vector of double pointers //add double pointers to the vector OR call populateD to populate the vector double lookFor=1.2; int index=**the return from the findMore function properly passing the vector and lookFor if(index < 0) //value more than lookFor was not found else //value at index was the first value more than lookFor */ return 0; }

void populateD(vector* vpop){ double * dp=new double[10]{0.0, 2.6, -1.0, 2.9,3.0, 192.2, .023, .468, -88.2, -8}; for(int i=0;i<10;i++){ vpop->push_back(dp+i); } }

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!