So I have a example text file which contains weather stats.
Example of text file:
2012-01-01 Rain 7 13 0.28
2012-01-02 ScatteredClouds 4 8 0.25
2012-01-03 Rain 6 12 0.28
2012-01-04 Rain 5 10 0.28
2012-01-05 Rain 7 12 0.28 ... //they are a plenty of list more
How can I read them by putting each data into different type? I already done for the input/output for the text file but I can't figure out how can I arrange my data, I tested a few ways but it still didn't work.
I knew it could be done with structures and classes, but I am a bit confuse for the private and public part. Which item should I put it in private/public? For my data, there are "Date, Weather, Min. Temperature, Max. Temperature, Rainfall (mm)".
Ah shit, my bad I had a mistake in my code, I fixed it there now. It's not freezing, it's waiting for your input because you're using cin >>. You want to use the file instead.
So I am done for this part, including moving my variables to classes and make my program become more neatly. =D
For another part of this program, I need to sum up the data I stored in classes and rearrange it.
Example: User input year "2002", the program will auto calculate the part that are belongs to year "2002" and average of minimum/maximum temperate, total rainfall, and also count how many type of weather in the data such as :
Cloudy X(number)
Rain Y(number)
The confusion part is, how do I compare the data inside vector and when users input year the program will only calculate for certain year?