0% found this document useful (0 votes)
50 views3 pages

Hw4 Assignment

The document provides instructions for an assignment to write a C++ program that will analyze player data from a text file and select the top six players based on criteria. The program is required to have functions for reading input from the file, calculating averages, filtering players based on criteria, selecting the top six players, and printing the results. The grading rubric allocates marks to style, declarations, prototypes, file handling, criteria checking, average computation, selection of top players, and printing functions.

Uploaded by

Said
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
50 views3 pages

Hw4 Assignment

The document provides instructions for an assignment to write a C++ program that will analyze player data from a text file and select the top six players based on criteria. The program is required to have functions for reading input from the file, calculating averages, filtering players based on criteria, selecting the top six players, and printing the results. The grading rubric allocates marks to style, declarations, prototypes, file handling, criteria checking, average computation, selection of top players, and printing functions.

Uploaded by

Said
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

Sultan Qaboos University

College of Science
Department of Computer Science
COMP2002, spring 2017
Assignment No. 4
Due Date: 1/05/ 2017 (11:55pm)

Northern Basketball Club (NBC) has data about the points scored by some of its best players in
five matches, in a file called “Playersdata.txt”, text file will be provided to you for completing
the homework. NBC wants to select maximum of six players using an automated system.

This file contains columns header and unknown number of records but maximum is 25. There is
a criterion to select the players.

 Match1 and Match2 Points must be greater than zero.


 Points of Match3, Match4 and Match5 must be greater than the Average of all five
matches.

Write a C++ program to get the list of maximum of six players who satisfy above criteria. If more
than six players satisfy above criteria then select only top six average players. Your program
should include arrays and the following functions to achieve the modularity.
void input_criteria(int player_id[], double player_ avg[]): Reads input from file. If a record
satisfies above criteria then adds player id and player average into corresponding arrays.

void Top6(int pid[], double pavg[]): Selects six highest average players.

print (int count, int pid[]): This function opens input data file and match the array ids and print
in the format shown below:
Grading Table

Max Marks
No. Item
marks scored

1 Style (comments, naming, indentation) 3

2 Declarations 2

3 Prototypes 1

4 Opening/checking/ file 2

5 Input_criteria function(Reading input) 3

Computing average and satisfying criteria and filling 5


6
arrays

7 Print function 5
.
8 Top6 function 6

Total 25

You might also like