I have a project to write and am having trouble with how to start. I am using visual studios. The first part of the prompt is
"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."
I know how to open the file but from there I don't know how to get the first two numbers of the file to determine how big my array is or how to store the rest of my values into a 2D array. please help!
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
usingnamespace std;
int main()
{
int formulation = 0, num_plants = 0;
ifstream src("filename");
if (!src)
{
perror("Error: ");
exit(EXIT_FAILURE);
}
src >> formulation >> num_plants;
// TODO
// Create your array and read the data into it
system("pause");
return 0;
}