Yes, I realize that using a struct would be much easier, however, I am not allowed to do that in my assignment which is why I'm completely clueless on how to do this
std::ifstream fin("mYDoc.txt");
int length[3], tmp;
for (int i = 0; i < 3; ++i)
{
fin >> tmp; // width
fin >> length[i];
fin >> tmp; // area
fin >> tmp; // height
}
I mean, I don't really know. What we have to do is for the read function, open the file, pull out the four lines at a time till eof, take the 2nd line (length), put that into an array (which is passed by reference) and then return nothing. Then in the main function we have to define the array, call the read function, and when the array is done being built, find the sum of the contents and print out the sum. And we are given this function prototype: void read_data(ifstream& input, int arr[]); to pass the array as a parameter. I am just completely confused, but thanks for trying to help me.