Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

6. What data will she need?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago