Hello, i'm looking for a bit of guidance on an issue i have.
I'm building an application that can read weather data from a .txt file. I have built my menus which navigate to different parts of the app that will pull various bits of data dependant on what the user is selecting eg(Yearly reports, monthly reports, average yearly temperature etc) However i'm struggling on a section where i am requiring the program to find the Highest max temperature within the text file. I have my program reading the file and converting all of the values from strings within the text file to float values within the program, however i can't for the life of me work out how to get the program to read and print out the largest number from the text file. Any guidance would be most helpful
The formatting of the file is as follows:
Year, month, max temp, min temp
1988, 12, 30.5, -1
Have an extra variable for "max value found so far". When you loop across your file, check in each iteration if the current value is greater than the max value found so far. If it is, then update the max value found so far to match the current value.
Hey, i've managed to get it working to a degree thanks, i'm at this stage now, i'm using this to grab the higest values, however it will print out in descending order the top values it finds.
So first value is 23 then the next highest 25.6 and then onto 26.5 (using small set of data) however when it prints it will print out the first value followed by the next 2 values that exceed it as follows