Question: C++ Code Assignment (finish the code) We are learning about arrays. We have to finish the code that I included at the bottom of the
C++ Code Assignment (finish the code)
We are learning about arrays. We have to finish the code that I included at the bottom of the page. Here is the assignment:
read_data finish this function code to read in information on 4 states, name, population, number of republicans and number of democrats. You must also finish the call statement in the main function and add the necessary parameters to the function header.
print _data finish this function code to print out all of the data read in. You must also finish the call statement in the main function and add the necessary parameters to the function header.
calculate_data finish this function to print the percentage of republicans and the percentage of democrats. You must also finish the call statement in the main function and add the necessary parameters to the function header.
find_data finish this function code to find the state with the highest population and pass the name back to the main function where it will be printed. You must also finish the call statement in the main function and add the necessary parameters to the function header.
Here is the code template:
#include#include using namespace std; void read_data(string state[],int population[],int republic[],int democrate[]); void print_data(string state[],int population[],int republic[],int democrate[]); void calculate_data(string state[],int population[],int republic[],int democrate[]); string find_data(string state[],int population[]); int main() { string high_state; string state[4]; int population[4]; int republic[4]; int democrate[4]; read_data(); print_data(); calculate_data(); find_data(); system("pause"); return 0; } void read_data() { } void print_data() { } void calculate_data() { } void find_data() { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
