Question: C++ with comments: 1 Write a program that creates an array of integers of size 10; you should declare the array and set the 10

C++ with comments:

1 Write a program that creates an array of integers of size 10; you should declare the array and set the 10 values at the same time using the chain brackets. The program must output the largest element in the array, and the index at which that element was found.

1.1 now write a function to find the maximum value, called find max, which takes in an array and returns both the largest element in the array, and the index at which that element was found. Demonstrate your function working in the main function.

1.2 this time your program/function should work for an array of length n, where n is input by the user; the user should be asked to enter each value one at a time. You must use a pointer and dynamic allocation to create the array. You will also need to change your function to accept a pointer as input, rather than an array.

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!