My program reads two temperatures from a file, the min and max temperature for each day of a given year.
My problem is to write a function which accepts a year and a month as parameters for example) (2016, 3) (3 means March) and returns the starting location for that month in the arrays which store the temperature values.
The text file has a total of 366 numbers on it.
An example: if the user enters 2016 and 1 for January, the program should return 0 for the location in the array.
I'm not asking to solve, but if someone could help me understand how to create this function, it would be greatly appreciated
It went along the lines of, if user enters '1' for month, then the counter will add 0 to itself and return the index.
If user enters '2', then counter adds 31 to the index (as January has 31 days so it would need to move from index 0 to 30)
Problem is, I don't know how to structure the code for this idea correctly