Question: Once you have written the City class, write a function, maxPopulation, to find the index of the city with the largest population in an array.

Once you have written the City class, write a function, maxPopulation, to find the index of the city with the largest population in an array. Function Specifications: Name: maxPopulation() Parameters (Please Follow the same order): o cities[] (City) - array of cities o size (int) - number of cities in the cities array Return Value: the index of the city with the largest population - index (int) Example Function Call: int index = maxPopulation(cities, 5); The function should find the index of the city with the largest population and return it. If there is a tie between cities, choose the earliest one in the array. If the array is empty, return -1. Paste in the contents of your City.h and City.cpp files in the box below, as well as your maxPopulation function.. Answer: (penalty regime: 0 %)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
