Hey, I am trying to declare an array of 12 structs that will hold information from a file input.
I have my struct
and this is my array
These are my struct variables.
each of the struct variables will be placed in the array respectively, but I am unsure how to read the information from the file putting them in their rightfull place.
The values in the input file will be separated by blanks. A sample single line in the input file might be:
20.1 78.2 40.1
How would I go about placing 20.1 into jan.totalRain in my array?
I hope I explained myself clearly, If not just let me know.
Thank you all for your help in advance.
I have my struct
Code:
struct month
{
float totalRain, highTemp, lowTemp, averageTemp;
};
and this is my array
Code:
struct month fullYear[12];
Code:
month jan, feb, mar, april, may, june, jul, aug, sept, oct, nov, dec;
each of the struct variables will be placed in the array respectively, but I am unsure how to read the information from the file putting them in their rightfull place.
The values in the input file will be separated by blanks. A sample single line in the input file might be:
20.1 78.2 40.1
How would I go about placing 20.1 into jan.totalRain in my array?
I hope I explained myself clearly, If not just let me know.
Thank you all for your help in advance.
Comment