CPSC 1375 Programming I HW4 (A classical "single control break" problem) The results of a series of quizzes in a certain course are in the data file "quizzes.dat". A typical record in this file consists of a student's ID number (of type int) and a quiz score (also of type int) for the student. The file is arranged so that all the records for a particular student are lumped together; to illustrate, the first few records in the file are: 67 100 53 quiz scores for student # 10234 in no quiz scores for student # 11245 99 10234 10234 10234 10234 11245 11245 11245 14652 14652 14652 14652 14652 14652 19832 100 56 99 100 96 quiz scores for student # 14652 Note that the number of quizzes a student has taken can vary! Your job is to write a C++ program to loop through this file and, for each student, output the student's ID number along with the student's quiz average after the highest and lowest quiz scores for the student has been thrown out. Thus, in our example, the first few lines of your output should look like 10234 11245 14652 79.00 89.00 93.Programming notes: (1). In outputting, format the averages to two decimal-place accuracies. Also keep in mind that "integer division truncates", i.e., remember to use "casts". (2). You can assume that everyone in the file has taken at least three quizzes, i.e., you need not worry about "dividing by zero" (continued on back) page 2 after the maximum and minimum grades have been thrown out. (3). Note that you should throw out only one occurrence of the maximum and not all occurrences. (See student # 14652 above.) A similar statement applies to minimum grades. (4). A programming hint: Make a "special case" out of the first record in the file by reading it in separately, and then, in your main loop, read records and react accordingly depending on whether the ID field is different or the same as the previous ID inputted.
Get Free Quote!
319 Experts Online