Question: C++ Write a function, maxRadius, to find the index of the planet with the largest radius in the array. The function should: Be named maxRadius
C++ Write a function, maxRadius, to find the index of the planet with the largest radius in the array. The function should:
Be named maxRadius
Take two arguments in the following order
An array of planet objects
An integer, the size of the array (possibly partially filled, so this would be the number of actual planet elements in the array)
Return the index of the planet in the array with the largest radius.
If multiple planets in the array share the largest radius, your function should return the index of the first planet.
If the array of Planet objects is empty, your function should return -1
Add comments if possible
Examples: Function call Output Bird World 4321 3.37941e+11 Planet planetsLS planets [0] = Planet ("On A Cob Planet", 1234); planets[1]Planet ("Bird World", 4321) int idxmaxRadius (planets, 2); cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
