Need help with a c project Each row of the table represents
Need help with a c++ project
Each row of the table represents a specific formulation and each column represents a specific plant. Your program should have a main function and 4 other functions as described below. The manufacturer has stated that there will not be more than 50 formulations and not more than 12 plants.
One function should open the file and read the first line that contains the number of formulations (the first value) and number of plants (the second value). Using these values, your function should then read the rest of the data and store the values in a 2-dimensional array. As the compressive strengths are being stored, a message should be output if any compressive strength is not in the range of 15 to 75 MPa. The message should output the formulation, plant and compressive strength as the example below.
The value of 14.56 from plant 1 for formulation 8 is suspect.
The compressive strength should still be stored in the array. The number of formulations and number plants should be sent back to the function call
One function should accept the 2-dimensional array, the number of formulations and number of plants then create a 1-dimensional array containing the minimum compressive strengths for each formulation and create a 1-dimensional array containing the maximum compressive strengths for each formulation This function should call the function to output a 1-dimensional array for the minimum and maximum values before sending these arrays back to the function call.
One function should accept the 2-dimensional array and determine the average compressive strength for each formulation. The average for a each formulation should be calculated without including the maximum and minimum compressive strength for that formulation, therefore this function will need to call the function that calculates the minimum and maximum compressive strengths for each formulation. The average compressive strengths for the formulations should be stored in another 1-dimensional array which is sent back to the function call.
One function that will accept a 1-dimensional array, the number of values stored in the array and a description of what is stored in the array, e.g “minimum compressive strength for each formulation”, “ average compressive strength for each formulation”, etc. The function will then output the description and the values. The values should be output to 4 significant digits;
The main function should prompt the user to enter the filename for the data file and call the function to import the data from the file into a 2-dimensional file. Next main should call the function to calculate the averages of the formulations. The main function should then call the function to output a 1-dimensional array sending the array of averages to the function to calculate the 1-dimensional array.
we are not allowed to use pointers, dynamics arrays or vectors
here is the data file
Data file for Project 4 CompStrengths.dat 19 43.16 41.54 33.30 42.07 37.45 35.87 37.43 35.59 43.63 48.47 48.23 48.25 46.01 40.38 46 . 15 48.89 28.47 30.10 29.18 26.09 27.88 24.64 29.67 23.56 15.72 16 \' 76 8.22 25.75 21.3 16 .98 25.48 23.15 59.59 59.03 61.28 61.25 56.54 59.88 59.34 62.51 34.37 34.44 26 .55 30.31 25.14 25 .55 29.97 36.13 66.92 71.49 69.10 74.47 65.64 70.13 72.21 74.40 61.18 55.34 49 .03 52.03 50.75 64.4 52.54 57.99 41.04 46.44 38.18 34.99 34.89 44.44 41.11 41.02 77.10 71.46 70.99 77.94 65.98 73.48 74.18 68.78 29.08 22.17 22.26 28.52 31.61 40.93 24.67 28.94 56.21 52.6 56.96 57.96 61.85 54.22 46 .45 51.64 65.42 55.71 63.84 60.5 65.75 52.16 59.21 55.17 35.72 29.48 31.14 23.83 25.59 26.18 30.36 26.17 50.10 41.84 46 .94 45.53 43.27 49.52 48.85 48.10 55.00 62.38 60.5 58.10 59.07 58.21 53.75 58.14 59.51 59.06 58.53 60.40 55.99 64.89 63.56 61.94 67.90 65.61 71.06 67.60 65.86 72.05 67.33 66.23 0965130928484770443 585-5140) 7 9 2 6 1 1 1 192 58332647-88715688_6 3422637546265524566 35784714-875-5563 4164302511654238753 7695902214406908337 3422527547274534566 784885348362682-95 8369) 8 5 1 4 4 4 g 5 2 1 1528 5469544354269842 3421527647465524567 51844459815597796 4 830 5 1 6 7 8 9 6 2 8 7 5 298 7671655O45-41553955 3422526536376624556 75955-730) 4 2 3 6 33 2072349959585-46 2865-42478-735807 4422637537265624566 8 38200 5 3 8 9 6 1 6 4 4 4 5 36 32-225--92898-950 3898-6998?2763-681 342 626437265634657 47634944673-84861 5417044344136748306 11860) 4 1 5 6 1 2 0 2 5 9 1295 4431537547265524656 6372972840891220010 1647539-I5247159 33859461-799655597 4421536647265635556Solution
You declare an array in essentially the same way as you declared the variables that you have seen up to now, the only difference being that the number of elements in the array is specified between square brackets immediately following the array name. For example, you could declare the integer array height, shown in the previous figure, with the following declaration statement:
Because each long value occupies 4 bytes in memory, the whole array requires 24 bytes. Arrays can be of any size, subject to the constraints imposed by the amount of memory in the computer on which your program is running.
You can declare arrays to be of any type. For example, to declare arrays intended to store the capacity and power output of a series of engines, you could write the following:
If auto mechanics is your thing, this would enable you to store the cubic capacity and power output of up to 10 engines, referenced by index values from 0 to 9. As you have seen before with other variables, you can declare multiple arrays of a given type in a single statement, but in practice it is almost always better to declare variables in separate statements.

