CIS 15/615                                         INSTRUCTOR : RAVE HARPAZ

 

ASSIGNMENT # 1

 

 

Structures and Arrays of Structures

 

Your goal is to write a ‘C’ program implementing the topics we covered in class regarding structures and arrays of structures. The program should mange and analyze data concerning a basketball match played by 5 basketball players in a basketball team.

 

Program guidelines:

 

1-    Define a struct type named player_rec that will represent and hold statistics regarding a player in a basketball match. The struct type you define should contain the following information (fields): player’s name, his score in the match, number of rebounds and number of assists he had.

 

2-    The whole team should be represented as an array of 5 player_rec type elements. The array is to be named stars.

 

3-    The data for each one of the players is: {“sam”,10,6,2},{“dan”,12,9,1},          {“jim”,2,10,0},{“james”,0,4,9} and {“nick”,20,1,0}. You may use any method discussed in class to assign the data to each one of the players. Note that since the team is stored in an array each player’s record is accessed via an array index.    E.g. stars[0] will hold sam’s record, starts[1] will hold dan’s record…

 

4-    After data is assigned to each one of the players the program should traverse the stars array and find the best scorer and best rebounder. The results should include the player’s whole record accompanied by appropriate messages. E.g.

                                                  the best scorer is: nick.

                                                            number of points: 20

                                                            number of rebounds: 1

                                                            number of assists: 0

 

5-    Do not forget to comment you program

 

6-    You should hand in the source code and the output of the program, you can do that by redirecting your output through the DOS prompt or by printing your results to a file.

 

 

 

Good luck !