(III. 11. Managing the scores of the entries: n contestants (ngt; 1), m judges (mgt; 2), and the judges give each contestant a score (the score is a positive real number less than or equal to 10). The final score of the contestant is calculated as (1) mlt; At 9:00, the average of the other m-2 scores after removing the highest score and the lowest score. (2) When m ≥ 9, the average of the other m-4 scores after removing the two highest scores and the two lowest scores. Suppose that a text type data file f1.txt has been built in advance, in which n contestants' numbers (a positive integer), names (a string) and scores given by m judges are recorded successively. Please prepare a program to read the relevant information of n contestants from the data file f1.txt in turn, and then calculate the final score of each contestant according to the above rules and methods, and output the result information in the following way to the screen and another text file f2.txt. Assuming the number of contestants n=5, the number of judges m=7, the initial data in the disk file f1.txt is: 1zhangjin8.89.37.98.78.99.79.22lintao8.98.28.68.88.59.33guojian8.98.48.68.68.68.44saling7.98.38.38.68.58.98.35liuyifan9.59.19.89.29.09.98.9 Then, after the program executes, the results displayed on the screen and the results in the disk file f2.txt should be: ------------------------------------------------------------ Contest No? name? Highest score? Lowest score? Accumulated points? Final score ------------------------------------------------------------? 1zhangjin?? 9.7?? 7.9?? 44.9?? 8.98? 2? lintao?? 9.3?? 8.2?? 43.9?? 8.78? 3? guojian?? 8.9?? 8.4?? 42.9?? 8.58? 4? maling?? 8.9?? 7.9?? 42.2?? 8.44? 5liuyifan?? 9.8?? 8.9?? 46.3?? 9.26 ---------------------------------------------------------------------------- Consideration: further consideration can be given to finding the first to the kth place in the competition, and also output relevant results information on the screen and in f2.txt (k is less than or equal to n, and the rule is that if multiple contestants finally get points together, the highest score in the valid score (that is, after the original highest score has been deleted) will prevail). The source program is as follows:
Manage the score of entries. doc)