Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A copy of Pr7-19.cpp has been added as a template in your program window. The program produces the output as shown in Figure 1. Figure
A copy of Pr7-19.cpp has been added as a template in your program window. The program produces the output as shown in Figure 1.
Figure 1:
The arrays values are: 1 2 3 4 5 6 7 After calling doubleArray the values are: 2 4 6 8 10 12 14
- Add a function with the following prototype: int highestElement(int [], int); the function highestElement() should find and return the highest element of the array. Hint: You may consult slide 3 of Module 7, Lesson 1-> CS1336_Lect7c_Arrays_Compare_Parallel.pptx for sample code that finds the highest value in an array.
- Call the highestElement() function after showValues() is called at line 25. The return value from the function can be saved in a variable. Another option is to embed the function call (which will return the highest element) in the cout statement that prints the highest element in the specified format.
Your program should produce output as shown in Figure 2.
Figure 2:
The arrays values are: 1 2 3 4 5 6 7 After calling doubleArray the values are: 2 4 6 8 10 12 14 The highest element in the array is 14
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started