Question: Hello, C++ question please. Design a program that will (in the main function) declare 2 arrays that can each store a maximum of 20 double

Hello, C++ question please.

Hello, C++ question please. Design a program that will (in the main

function) declare 2 arrays that can each store a maximum of 20

Design a program that will (in the main function) declare 2 arrays that can each store a maximum of 20 double type values declare the variables necessary to store a file name (string) and represent a file (ifstream) display your name, lecture and lab section #s,and exercise # to the screen interactively prompt the user for the name of an input file and read the file name open the file (using an ifstream type variable to represent the file) . read the content of the file o first value in the file will be an integer, n, that is greater than 0 and less than or equal to 20 o n indicates how many values are to be stored in one of the arrays o read the n values and store them into one of the arrays close the input file call a void function that will be passed the 2 arrays (the array with the input values and the array that was not initialized) and the number of elements that were stored (n) o using the values in the input array, the function should do the following double the value of each of the elements in the input array that have even subscripts (0,2,4.) and store them in the corresponding locations of the second array determine the cube root of each of the values in the input array that have odd subscripts (1,3,5,...) and store those values in the corresponding locations of the second array print (to the screen) the content of both arrays (in 2 right justified columns with headings) " return to main call a value-returning function to sum all the values in the input array and then call the function again to sum the first int(n/2) values in the second array o the function should be designed to receive 2 parameters, an array of doubles and an integer, size o the function will add the first size values in the array and return the result print the sum of all the values in the input array with a label print the sum of the first int(n/2) values in the second array with a label REQUIREMENTS .Program must read input from a file using a filestream (no redirection) The input file can only be read 1 time All header files referenced must be included No global variables may be used The void function must set the values for the 2nd array as described above and print the content of the 2 arrays in right justified columns (see example below) with 5 digits to the right of the decimal Only one value returning function to sum the values can be implemented. It must be called twice

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!