Question: Write a function void get _ info ( string & state, string & capital, int & population ) . This function will simply prompt the

Write a function void get_info(string & state, string & capital, int & population). This function will simply prompt the user to enter 3 separate values, respectively representing a State, a Capital city, and its population. Notice that the three parameters are passed by reference
Write a function void show(string states[], string capitals[], int populations[], int count). This function will simply loop through each of the arrays, displaying each arrays elements. The count variable is used to determine how many elements of the array will actually be displayed. Sample output of this function should look as below (count is 2 in this example):
CA, Sacramento (1000)
OR, Salem (2000)
Write a function int total(int array[], int size). This function will simply loop through array to calculate the total of the elements. The size parameter dictates how many of the elements are used in the calculation. The return value of the function is the calculated total.
See the sample main below, copying the starting code given. Write the additional code in main as follows:
Write a loop that runs SIZE iterations. Within this loop:
Call the get_info() function passing in state, capital and pop appropriately. Because get_info() passes parameters by reference, after the function call, the variables passed in will contain the users inputs
Fill in the states, capitals and populations arrays with these three user inputs at the proper element locations. Your loops counter variable is perfectly suited to use as an index for these arrays.
Increment count. This count variable represents how many sets of information have been entered (In this case, one set comprises a state, a capital and a population)
Call the show() function passing in the appropriate parameters
Display a message showing the total population entered so far (See the sample interaction). Remember that you wrote the total() function that can be used to calculate the total population.

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!