Question: C++ Coding This program will read the contents of a file into an array and calculate various values based on the contents of the file
C++ Coding







This program will read the contents of a file into an array and calculate various values based on the contents of the file The program will make use of a two dimensional array that has 20 rows and 5 columns You will be reading in the contents from a file. You will need to read the file name from cin The file will consist of up to 20 sets of 5 values. The values will all be double floating point values readFile function One function you will be required to have is called readFile. This function will read the input file. Each read will read in 5 columns of information into the next available row in the two dimensional array. The first 5 values are read into row 0, the next 5 values will be read into row 1, and so on up to 20 rows of input. You will need to keep track of how many rows of input you have read in. This could be anywhere from 0 to 20. If there are more than 20 rows of input you should only read in the first 20 rows To help facilitate this you need to create a global const int value for the maximum number of columns Your program should use thisconst value when creating the arrays or when defining function prototypes and function headers You will also be creating a const int value for the maximum number of rows, but this will be in your main function. You should not be hard coding 5 or 20 in your code anywhere except in the two const int declarations. The only possible exception to this is the readFile function. It is easier to just read in all 5 columns at a time. If you want to just read in an entire row at a time you can do that in the readFile function. It is possible to write your code to use the MAX_COLUMNS value and read in one value at a time, but it makes the program logic more difficult. Once you have your code working and submitted you might want to see if you can read in the values using MAX_COLUMNS and reading in just one value at a time. This enhancement is not required for the assignment. No other use of global variables is allowed Here is an example of some partial code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
