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); coutStep 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