Question: Modify the program to also display the lowest number in the array. Use a value-returning function named getLowest. Test the program appropriately. #include using namespace

Modify the program to also display the lowest number in the array. Use a value-returning function named getLowest. Test the program appropriately.

#include

using namespace std;

// function prototype

int getHighest(int numArray[ ], int numElements);

int main( )

{

int numbers[4] = {13, 2, 40, 25};

cout << "The highest number in the array is "

<< getHighest(numbers, 4) << "." << end1;

return 0;

} // end of main function

//*****function definitions*****

int getHighest(int numArray[ ], int numElements)

{

// assign first element's value to the high variable

int high = numArray[0];

// begin search with second element

for (int sub = 1; sub < numElements; sub += 1)

if (numArray[sub] > high)

high = numArray[sub];

// end if

// end for

return high;

} end of getHighest function

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!