Question: Task B: 1. New Project and give your project the name Lab4B. 2. Add a source file to your project, called FindMax.cpp. 3. C++ program
Task B: 1. New Project and give your project the name Lab4B.
2. Add a source file to your project, called FindMax.cpp.
3. C++ program with a function named FindMax that has two parameters, one in type constant pointer to constant double array (i.e. const double* const arr), another one is in int type that represents the size of the array.
Your task in this part is to find the position of array element with the maximum value. Instead of returning the array index, a pointer to the maximum element should be returned (note: the returned pointer should be made in a way that the value of the maximum value is unchangeable.)
Assumption: All the floating point values in the array are distinct. Your main function should start by asking the user how many numbers he/she would like to input, then followed by asking all the values. At the end of the program, print the maximum value obtained from the FindMax function. A sample screen display when the method is called is given below: How many numbers do you like to enter?
5 Enter values: 10.5 2.1 5.21 1.23 23.8 The maximum value: 23.8 The input which is underlined is the user's input to a question.

Task B: 1. Create a New Project and give your project the name Lab4B. 2. Add a source file to your project, called FindMax.cpp. 3. Write a C++ program with a function named FindMax that has two parameters, one in type constant pointer to constant double array (i.e. const double* const arr), another one is in int type that represents the size of the array. Your task in this part is to find the position of array element with the maximum value. Instead of returning the array index, a pointer to the maximum element should be returned (note: the returned pointer should be made in a way that the value of the maximum value is unchangeable.) Assumption: All the floating point values in the array are distinct. Your main function should start by asking the user how many numbers he/she would like to input, then followed by asking all the values. At the end of the program, print the maximum value obtained from the FindMax function. A sample screen display when the method is called is given below: How many numbers do you like to enter? 5 Enter values: 10.5 2.1 5.21 1.23 23.8 The maximum value: 23.8 The input which is underlined is the user's input to a question. 4. Compile your program and test it by executing your program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
