Page 150 -
P. 150

data in files and arrays


           Find the highest score in the results file


          After the judges rate the competitors, the scores are stored in a file called
           results.txt. There is one line in the file for each competitor’s score. You
           need to write a program that reads through each of these lines, picks out the
           score, and then works out the highest score in the Surf-A-Thon.








                                                 Score
                                     Official Judging Dude   7.81
                                                8.65

                                                9.12
                                                8.45


                                        Brad
                                                8.05
                                                                                  the results.txt file.
                                                7.21                              Results are stored in
                                                8.31











           It sounds simple enough, except for one small detail. You’ve written programs
           to read data from the Web, and read data that’s been typed in at the keyboard,
           but you haven’t yet written any code that reads data stored in a file.















                                                                                       you are here 4    115
   145   146   147   148   149   150   151   152   153   154   155