Вы находитесь на странице: 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

Вам также может понравиться